This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Little Book of Impediments (e-book only) and have Tom Perry on-line!
See this thread for details.
Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Merging orm.xml and annotations, possible?

 
Alejandro Dominguez
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good day to all,
I'm using EJB 3.0 with Java Persistence; I have my entities annotated and everything works fine; my question is: is it possible to provide the orm.xml so that only the table that is mapped is overriden? I tried doing this, but when I deployed the ear it said that I was missing the id for the entity, so I understand that I should provide all the mapping informations in the orm.xml. However, everything else is fine and I don't want to re-write everything, I just want to change the table that the entity maps to.

Is it possible? Any ideas?

Regards

Alejandro
 
Mike Keith
author
Ranch Hand
Posts: 304
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sure. In your orm.xml file you should only need to include the <entity> element with the <table> element inside it. The table in the XML file should then override the annotation.

-Mike
Pro EJB 3: Java Persistence API
 
Alejandro Dominguez
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ah, thank you Mike;
when I was trying I put access="PROPERTY" and it was asking for the identifier of the entity to be added. Once I removed the access property, it worked perfectly.

Regards and thank you

Alejandro
 
Alejandro Dominguez
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ah, thank you Mike;
when I was trying I put access="PROPERTY" and it was asking for the identifier of the entity to be added. Once I removed the access property, it worked perfectly.

Regards and thank you

Alejandro
 
Alejandro Dominguez
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hups, double post
[ June 04, 2007: Message edited by: Alejandro Dominguez ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic