This week's giveaway is in the Spring forum.
We're giving away four copies of Learn Spring Security (video course) and have Eugen Paraschiv on-line!
See this thread for details.
Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Specifying unique key constraint in jbosscmp-jdbc.xml

 
adrian mills
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 190
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic