aspose file tools*
The moose likes JBoss/WildFly and the fly likes Specifying unique key constraint in jbosscmp-jdbc.xml 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 "Specifying unique key constraint in jbosscmp-jdbc.xml" Watch "Specifying unique key constraint in jbosscmp-jdbc.xml" New topic
Author

Specifying unique key constraint in jbosscmp-jdbc.xml

adrian mills
Ranch Hand

Joined: Dec 09, 2004
Posts: 63
Hi All,

I am using an entity bean to create my table in MySQL4.1.13
I have a table called user which has userid,username,password as its columns.
The userid is a primary key over here.
But I want the user name to be unique.
I.e if a user with the name 'Adrian' is present in the database then another user with this user name should not be created.

I have been told that you can configure a unique key in jbosscmp-jdbc.xml using insert-after-ejb-post-create.

But i dont know how to use it.
Can anyone give me a sample code for using this.

Any help would be appreciated.
Thanks
p2
Ken Loh
Ranch Hand

Joined: Feb 16, 2005
Posts: 190
Hi Adrian,

Just in case the answer you're seeking is not forthcoming, do consider setting the username as a unique column in your table at the database.

Sorry that I couldn't provide the actual answer that you want.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Specifying unique key constraint in jbosscmp-jdbc.xml
 
Similar Threads
Help me to remove this Error in Entity Bean
JBOSS EJBQL generate wrong SQL
Can't deploy EJB to JBOSS after adding '@ejb.finder' clause
Jboss:Hypersonic:Manual table creation:CreateException
CMP bean Deployment Problem with DataSource (mysql)