For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub
- This topic has 6 replies, 3 voices, and was last updated 21 years, 11 months ago by
Greg.
-
AuthorPosts
-
tonno01MemberHi,
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,
MartinSeptember 18, 2004 at 9:47 am #215505
Riyad KallaMemberI have asked our XDoclet guy to have a look at this.
September 19, 2004 at 2:53 pm #215529
GregMemberMartin,
Do you have the “Version” attribute set to 3.2 and have it “checked”, in the jboss subdoclet under your “Standard EJB” configuration?
September 20, 2004 at 2:42 am #215551
tonno01Memberyes, i have. perhaps there is some other attribute missing…
martinSeptember 20, 2004 at 5:14 pm #215644
GregMemberAfter 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.
September 21, 2004 at 3:58 am #215665
tonno01MemberOk 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
martinOctober 1, 2004 at 10:20 am #216619
GregMemberIt 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.
-
AuthorPosts
