facebook

jboss post-table-create problem

💡
Our Forums Have Moved

For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub

  1. MyEclipse IDE
  2.  > 
  3. General Development
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #215500 Reply

    tonno01
    Member

    Hi,

    I am trying to use the post-table-create with myeclipse xdoclet but it doesn’t produce anything in the jbosscmp-jdbc.xml file. I am using jboss 3.2.5, Mysql and the MyEclipse Enterprise Workbench 3.8.0 Beta-2 for Windows. Here is the code of the entitybean.

    * @ejb.bean name = “Operator”
    * type = “CMP”
    * cmp-version = “2.x”
    * display-name = “Operator”
    * description = “Operator EJB”
    * view-type = “both”
    * jndi-name = “ejb/OperatorHome”
    * local-jndi-name = “ejb/OperatorLocalHome”
    * primkey-field = “operatorID”
    *
    * @ejb.persistence table-name = “Operators”
    *
    * @jboss.persistence table-name = “Operators”
    * create-table = “true”
    * post-table-create = “INSERT INTO blabla”
    *
    * @ejb.permission role-name = “Admin”
    * @ejb.permission role-name = “Login”
    *
    * @ejb.finder
    * signature = “Collection findAll()”
    * query = “SELECT OBJECT(o) FROM Operator AS o”
    * transaction-type = “Supports”
    *
    *
    *
    * @ejb:util
    * generate=”physical”
    *
    */
    public abstract class Operator implements EntityBean {
    ….
    ….

    the resulting jbosscmp-jdbc.xml file…

    ….
    <ejb-name>Operator</ejb-name>
    <create-table>true</create-table>
    <table-name>Operators</table-name>

    <cmp-field>
    <field-name>operatorID</field-name>
    <column-name>OperatorID</column-name>

    <jdbc-type>VARCHAR</jdbc-type>
    <sql-type>VARCHAR(64)</sql-type>

    </cmp-field>
    <cmp-field>
    <field-name>password</field-name>
    <column-name>Password</column-name>

    <jdbc-type>VARCHAR</jdbc-type>
    <sql-type>VARCHAR(64)</sql-type>

    </cmp-field>
    <cmp-field>
    <field-name>fullName</field-name>
    <column-name>Fullname</column-name>

    </cmp-field>
    <cmp-field>
    <field-name>address</field-name>
    <column-name>Address</column-name>

    </cmp-field>

    <!– jboss 3.2 features –>
    <!– optimistic locking does not express the exclusions needed –>
    ……

    What is wrong? Hope anyone knows an answer.

    Thanks,
    Martin

    #215505

    Riyad Kalla
    Member

    I have asked our XDoclet guy to have a look at this.

    #215529

    Greg
    Member

    Martin,

    Do you have the “Version” attribute set to 3.2 and have it “checked”, in the jboss subdoclet under your “Standard EJB” configuration?

    #215551

    tonno01
    Member

    yes, i have. perhaps there is some other attribute missing…
    martin

    #215644

    Greg
    Member

    After a little more research, it appears that there is a bug in xdoclet 1.2 jboss module.

    http://opensource.atlassian.com/projects/xdoclet/browse/XDT-635

    You can get this fix immediately, by downloading a xdoclet-lib-1.2.1,zip. Then copy all of the jar files that start with xdoclet* into $MYECLIPSE_INSTALL_DIR/eclipse/plugins/com.genuitec.jboss.ide.eclipse.xdoclet.core_3.8.1/ and remove the existing 1.2 xdoclet files. Then open the XDoclet preference page: Window->Preferences->MyEclipse->XDoclet and click “Refresh XDoclet Modules”. Then open Window->Preferences->MyEclipse->XDoclet->Code Assist and click “Refresh XDoclet Data”. Then run xdoclet again and the <post-table-create> element should be created.

    #215665

    tonno01
    Member

    Ok thanks, now it works, but i encountered another problem:

    – if i want to execute more sql commands it gives me an sql exception during deployment..

    the code of the ejb:

    * @jboss.persistence table-name = “Role”
    * create-table = “true”
    * post-table-create = “INSERT INTO Role VALUES (‘bla blaaa’);
    * INSERT INTO Role VALUES (‘blabla’);
    * INSERT INTO Role VALUES (‘bla bal’);”

    these results in jbosscmp-jdbc.xml in this way…

    ….
    ….
    entity>
    <ejb-name>Roles</ejb-name>
    <create-table>true</create-table>

    <post-table-create>
    <sql-statement>INSERT INTO Role VALUES (‘bla blaaa’); INSERT INTO Role VALUES (‘blabla’); INSERT INTO Role VALUES (‘bla bal’);</sql-statement>
    </post-table-create>
    ….

    this gives me an exception on server side during deployment….


    Caused by: java.sql.SQLException: Syntax error or access violation, message from server: “You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ‘; INSERT INTO Role VALUES (‘blabla’); INSERT INTO Role (‘”
    ….

    The other problem i have, i would like also to use the <post-table-create> tag also on a created m:n relation. Is this possible from xdoclet?

    Hope you know an answer..
    thanks
    martin

    #216619

    Greg
    Member

    It looks like MySQL doesn’t like the multiple SQL statements in one. You could try to break out the sql statements in mulitple elements:

    
    <post-table-create> 
    <sql-statement>INSERT INTO Role VALUES ('bla blaaa');</sql-statement>
    <spl-statement>INSERT INTO Role VALUES('blabla');</sql-statement>
    ...
    </post-table-create>

    If this does work, the problem will be that you can’t make xdoclet generate this multiple sql statements so it would be something you would have to create after xdoclet.

Viewing 7 posts - 1 through 7 (of 7 total)
Reply To: jboss post-table-create problem

You must be logged in to post in the forum log in