Matthew Webster - eudoxus@freeuk.com<br /><a href="http://www.matthewwebster.homeunix.net/" target="_blank" rel="nofollow">http://www.matthewwebster.homeunix.net/</a>
Matthew Webster - eudoxus@freeuk.com<br /><a href="http://www.matthewwebster.homeunix.net/" target="_blank" rel="nofollow">http://www.matthewwebster.homeunix.net/</a>
Matthew Webster - eudoxus@freeuk.com<br /><a href="http://www.matthewwebster.homeunix.net/" target="_blank" rel="nofollow">http://www.matthewwebster.homeunix.net/</a>
Originally posted by Matthew Webster:
Hi peeps,
I've had a look through the back-dated articles, so if the answer to this is there, I'm afraid I missed it.
When I have the ejb-jar.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ejb-jar PUBLIC
"-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN"
"http://java.sun.com/dtd/ejb-jar_2_0.dtd">
<ejb-jar>
<description>Service test application</description>
<display-name>Service EJBs</display-name>
<enterprise-beans>
<entity>
<cmp-field>
<description>Primary key</description>
<field-name>index</field-name>
</cmp-field>
<cmp-field>
<description>Description reference to translation table</description>
<field-name>description</field-name>
</cmp-field>
<cmp-field>
<description>Index entry</description>
<field-name>entry</field-name>
</cmp-field>
<cmp-field>
<description>Jndi name of bean used to access this entry's data</description>
<field-name>jndi</field-name>
</cmp-field>
<cmp-field>
<description>The locale this note is used in</description>
<field-name>locale</field-name>
</cmp-field>
<cmp-field>
<description>ID of the editor of this value</description>
<field-name>editor</field-name>
</cmp-field>
<cmp-field>
<description>The date this value was edited</description>
<field-name>edit_date</field-name>
</cmp-field>
<cmp-field>
<description>ID of the creator of this record</description>
<field-name>author</field-name>
</cmp-field>
<cmp-field>
<description>Date this record was created</description>
<field-name>auth_date</field-name>
</cmp-field>
<ejb-name>IndexEJB</ejb-name>
<local-home>server.entity.index.LocalIndexHome</local-home>
<prim-key-class>java.lang.Integer</prim-key-class>
<primkey-field>index</primkey-field>
<local>server.entity.index.LocalIndex</local>
<ejb-class>server.entity.index.IndexBean</ejb-class>
<persistence-type>Container</persistence-type>
<reentrant>False</reentrant>
<cmp-version>2.x</cmp-version>
<abstract-schema-name>INDEX</abstract-schema-name>
</entity>
</enterprise-beans>
<assembly-descriptor>
<container-transaction>
<description>Transaction attributes for 'IndexEJB' methods</description>
<method>
<ejb-name>IndexEJB</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
<security-role>
<description>This role represents everyone who is allowed full access bean.</description>
<role-name>everyone</role-name>
</security-role>
</assembly-descriptor>
</ejb-jar>
On it's own this causes JBoss to create the table in my MySQL database.
(Problem One: I cannot actually see the table in the database. I have only one installation of MySQL and only one database. Though this is not a MySQL question as that is not my main concern here.)
Problem Two: When I use the JAWS.xml file...
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jaws PUBLIC
"-//JBoss//DTD JAWS 2.4//EN"
"http://www.jboss.org/j2ee/dtd/jaws_2_4.dtd">
<jaws>
<datasource>java:/MysqlDS</datasource>
<type-mapping>mySQL</type-mapping>
<debug>true</debug>
<default-entity>
<select-for-update>false</select-for-update>
<create-table>true</create-table>
<remove-table>false</remove-table>
<time-out>300</time-out>
<tuned-updates>true</tuned-updates>
<pk-constraint>false</pk-constraint>
</default-entity>
<enterprise-beans>
<entity>
<ejb-name>IndexEJB</ejb-name>
<table-name>INDEX</table-name>
<read-only>false</read-only>
<create-table>true</create-table>
<cmp-field>
<field-name>index</field-name>
<column-name>INDEX</column-name>
<jdbc-type>INTEGER</jdbc-type>
<sql-type>NUMBER(10)</sql-type>
</cmp-field>
<cmp-field>
<field-name>description</field-name>
<column-name>DESCRIPTION</column-name>
<jdbc-type>INTEGER</jdbc-type>
<sql-type>NUMBER(10)</sql-type>
</cmp-field>
<cmp-field>
<field-name>entry</field-name>
<column-name>ENTRY</column-name>
<jdbc-type>VARCHAR</jdbc-type>
<sql-type>VARCHAR(256)</sql-type>
</cmp-field>
<cmp-field>
<field-name>jndi</field-name>
<column-name>JNDI</column-name>
<jdbc-type>VARCHAR</jdbc-type>
<sql-type>VARCHAR(256)</sql-type>
</cmp-field>
<cmp-field>
<field-name>locale</field-name>
<column-name>LOCALE</column-name>
<jdbc-type>VARCHAR</jdbc-type>
<sql-type>VARCHAR(10)</sql-type>
</cmp-field>
<cmp-field>
<field-name>editor</field-name>
<column-name>EDITOR</column-name>
<jdbc-type>VARCHAR</jdbc-type>
<sql-type>VARCHAR(10)</sql-type>
</cmp-field>
<cmp-field>
<field-name>edit_date</field-name>
<column-name>EDIT_DATE</column-name>
<jdbc-type>DATE</jdbc-type>
<sql-type>DATE</sql-type>
</cmp-field>
<cmp-field>
<field-name>author</field-name>
<column-name>AUTHOR</column-name>
<jdbc-type>VARCHAR</jdbc-type>
<sql-type>VARCHAR(10)</sql-type>
</cmp-field>
<cmp-field>
<field-name>auth_date</field-name>
<column-name>AUTH_DATE</column-name>
<jdbc-type>DATE</jdbc-type>
<sql-type>DATE</sql-type>
</cmp-field>
</entity>
</enterprise-beans>
</jaws>
JBoss refuses to create the tables in the database (they are not there to begin with and I get no message regarding their creation or lack of creation at all).
Apart from an explanation of the above problems, what I would really like is a description of exactly what is required to get JBoss to create a table from a bean definition and how that definition should be provided.
Thank you all in advance, and Happy New Year,
Matt.
MobileBytes blog - Sharing Technology - My Programming Knols
Stop it! You're embarassing me! And you are embarrassing this tiny ad!
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
|