• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can I mapping a table without primary key?(JPA)

 
keiwer villabona ruiz
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
in my database there is a table without primary key. (I did not)

I need to use that table.

thanks
 
Bill Gorder
Bartender
Posts: 1682
7
Android IntelliJ IDE Linux Mac OS X Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What kind of table is this? There are a number of different ways you can handle it but it really is situational.

If your table without a key has a foreign key into another table that does have an id, you can use the @Embedded annotation. You could use a pseudo id field containing all the columns in the database (but if they are not properly indexed this could cause performance issues), You could also choose to use JPQL for getting data from these tables versus the standard operations on the entity manager. Its really hard to say without more details.

Bill
 
keiwer villabona ruiz
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks James Sutherland (Y)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic