This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes JBoss/WildFly and the fly likes not-null & auto-increment Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "not-null & auto-increment " Watch "not-null & auto-increment " New topic
Author

not-null & auto-increment

Kalle Anka
Ranch Hand

Joined: Jul 06, 2005
Posts: 69
Hi,

this might be a really stupid question since I'm new to java EE. I'm trying to make a database table with entity bean: CREATE TABLE XXX { ID int not null auto-increment primary key, name varchar(255)};

So i have declared with xdoclet
* @ejb.pk-field
* @ejb.persistent-field column-name="ID"
* @ejb.interface-method view-type="local"
* @jboss.persistence auto-increment = "true"
* not-null = "true"

In ejb-jar the ID field has been declared primary key.
In jbosscmp-jdbc.xml the ID cmp field have been declared "not-null" and "auto-increment".

I'm using mySQL with I have changed in standardjbosscmp-jdbc.xml and I have declared
* @jboss.entity-command name="mysql-get-generated-keys"
In the entity bean


BUT still after deployment... when I type "show create table XXX" in my MySQL shell.... neither "not null" nor "auto-increment" is declared!

Any suggestions of what can be wrong?

Everything works fine if i manually create the SQL-table with "not null" and "auto-increment". Its really confusing.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: not-null & auto-increment
 
Similar Threads
OJB - Two entries in Table after commit
AutoIncrement primaryKey
Can some one help me with Entity Beans
JBoss CMP: "auto-increment" not recognised
ejbCreate, primary keys and deployment descriptors question