File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "not-null & auto-increment " Watch "not-null & auto-increment " New topic

not-null & auto-increment

Kalle Anka
Ranch Hand

Joined: Jul 06, 2005
Posts: 69

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.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:
subject: not-null & auto-increment
It's not a secret anymore!