• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

won't create tables with jaws.xml

 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Matthew Webster
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok, it appears that JBoss is actually creating the tables and dropping them immediately. I'm not sure why, so if anyone has any ideas on this I'd love to know.
Extract from log (which is another thing... anyone have good advice on configuring the logging in JBoss?)...
[15:39:41,661,JAWSPersistenceManager] Init SQL: CREATE TABLE INDEX (AUTHOR VARCHAR(10),EDIT_DATE DATE,EDITOR VARCHAR(10),INDEX NUMBER(10),AUTH_DATE DATE,LOCALE VARCHAR(10),ENTRY VARCHAR(256),DESCRIPTION NUMBER(10),JNDI VARCHAR(256))
[15:39:41,661,JAWSPersistenceManager] Destroy SQL: DROP TABLE INDEX
[15:39:41,661,JAWSPersistenceManager] Exists SQL: SELECT COUNT(*) FROM INDEX WHERE INDEX=?
Any ideas on what's going on here?

Matt.
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Matthew,
What is going on is that JBoss is setting up the queries it needs to create, drop, select, update and insert into that table. It is not executing the queries in any way ... it only reported what are the queries ...
What version of JBoss are you using?
 
Matthew Webster
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanx
I had got quite some way into working through all that - things took me away from it. I do, however, understand most of it now, having gone through the logs in detail and playing around with jaws.xml settings.
I'm using JBoss 2.4.4. I don't really have the time to get to grips with the latest version (due to getting to grips with lots of other things) unless anyone thinks it is really worth it- I've not heard good things so far.

Cheers,
Matt.
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
>>>>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.
JBOSS comes with a default database server hypersonic. If the JBOSS is giving you the message that created "somebean" table successfully It has created the table in the default database(Hypersonic). If you have to change the database then you have to copy mysql-service.xml to the default/deploy directory from docs/examples/jca. Here you can configure the database location and which database your program is going to use for creating tables.
Hope this helps you
Bijoy
 
Ranch Hand
Posts: 346
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.



Matt do by chance have MySQL setup for INNODB type tables? If so you still need an index key for inndob tables ..mysql is dropping it in that case becasue you do not have the index column defined for innodb..if you have winMysql open when you do the start up you should see the mysql system errors that its not settingup the table..it will be an error -1 if you try the saem create table statement from a front end such as iSQL Viewer if you forget the index column when MySQL is set to INNODB tables..
 
reply
    Bookmark Topic Watch Topic
  • New Topic