wood burning stoves
The moose likes EJB and other Java EE Technologies and the fly likes fk / pk constraint name Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "fk / pk constraint name" Watch "fk / pk constraint name" New topic

fk / pk constraint name

Bernhard Neuhauser

Joined: Feb 06, 2006
Posts: 21
Is it possible to tell the ejb3 layer the name of constraints?

For example a PK's name will be something like SYS_C0000123 using oracle. Something like PK_TABLE_ID would be helpful, because when a insert statement violates the constraint, the db will tell me the constraint name.

Maybe its implemention specific - currently im using jboss AS for ejb3 persistence.

Mark Spritzler

Joined: Feb 05, 2001
Posts: 17276

Unfortunately, you only get the Oracle name back. You can always have Oracle not automatically name the contraint for you and have your DDL give it a name, then you will see a nicer name.

This is an Oracle issue and not related to EJB or any App Server.


Perfect World Programming, LLC - iOS Apps
How to Ask Questions the Smart Way FAQ
Bernhard Neuhauser

Joined: Feb 06, 2006
Posts: 21
You are wrong, the issue has nothing to do with the chosen database.

This is mainly an ejb3 issue (or better said an issue of the mapper behind ejb3).

In my case, its hibernate. Hib generates the ddl based on the information taken from the ejb3 annotations. So the question is, how to tell the ejb3 layer to generate the ddl in a proper way.

I agree. Here's the link: http://aspose.com/file-tools
subject: fk / pk constraint name
jQuery in Action, 3rd edition