hi,

is there the same solution which is working with PostgreSQL?


Rafal

[EMAIL PROTECTED] wrote:

Hi,

I'm using it for some time now.

If you want to use the auto-increment with an unknown PK, check here :
http://www.kylev.com/projects/jboss/cmpauto.html

If you want to use auto-generated field with normal PK, you can do the following :

<jbosscmp-jdbc>
<defaults>
...
<entity-command name="mysql-get-generated-keys"/>
</defaults>

<enterprise-beans>
<entity>
<ejb-name>User</ejb-name>
<table-name>users</table-name>
<cmp-field>
<field-name>id</field-name>
<column-name>user_id</column-name>
<auto-increment/>
</cmp-field>
<cmp-field>
<field-name>name</field-name>
<column-name>user_name</column-name>
</cmp-field>
...
</entity>
</enterprise-beans>
</jbosscmp-jdbc>

The creation works like any other entity bean.
Just return 'null' at the end of your ejbCreate(...).
Your PK (generated value) will be available in ejbPostCreate()
with entityContext.getPrimaryKey().

Hope it helps,
Sebastien.

-------------------------------------------------------------------------

Hi,

i haven't managed to use the auto generating primary key of jboss 3.2.x
and xdoclet 1.2b3!
is there any example of _one_ simple ejb out there? i can't find
anything on google!

i included the following lines into my entity bean:
=2E..
* @jboss.unknown-pk
* class=3D"java.lang.Integer"
* column-name=3D"id"
* jdbc-type=3D"INTEGER"
* sql-type=3D"INTEGER"
* @jboss.entity-command
* name=3D"pk-sql"
* @jboss.entity-command-attribute
* name=3D"pk-sql"
* value=3D"SELECT max(id)+1 FROM TestEntity"
=2E..

what to write in ejbCreate()? better: how to handle the creation
process? any links, ideas suggestions?=20

thanx a lot
markus



-------------------------------------------------------
This SF.net email is sponsored by: SlickEdit Inc. Develop an edge.
The most comprehensive and flexible code editor you can use.
Code faster. C/C++, C#, Java, HTML, XML, many more. FREE 30-Day Trial.
www.slickedit.com/sourceforge
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user



-------------------------------------------------------
This SF.net email is sponsored by: SlickEdit Inc. Develop an edge.
The most comprehensive and flexible code editor you can use.
Code faster. C/C++, C#, Java, HTML, XML, many more. FREE 30-Day Trial.
www.slickedit.com/sourceforge
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to