Start networking and exchanging professional insights

Register now or log in to join your professional community.

Follow

Does hibernate work on tables which do not have a primary key?

How can we read or write data to a table which does not have a primary key using ORM frameworks?

user-image
Question added by Maria Thomas , Tech Lead , J P Morgan Chase
Date Posted: 2014/06/28
Leela Vinod Sirigina
by Leela Vinod Sirigina , Senior Java Software Engineer , Iton Corporation FZCO

No without primary key it will not work.

Abdulkareem Almahameed
by Abdulkareem Almahameed , Technical Lead , Software Engineer , KONY

No, till today Hibernate doesn't support tables without primary key

Mayank Rawat
by Mayank Rawat , Spark Developer , Iris software

No, Hibernate will not work without primary key.

Wasib Ali Khan
by Wasib Ali Khan , Software Engineer , Emaratech FZ LLC

Every table  should have some unique key. The mathematical definition of a relation is a set of tuples.  Furthermore, truly identical rows can not possibly have any meaningful semantics from the user's perspective.In some cases it may be sensible to go as far as mapping all columns of a view as a composite-id, but there is almost always some smaller business key.

Mudassar Hakim
by Mudassar Hakim , Requirement Analyst & Software Developer , L&T Infotech

The whole idea of hibernate maintaining unique objects within the session of the persistant context is via the primary key i.e. the Serializable key unless that table is a component table to the parent table

Yes it can work without primary key.

 

Mohammad Shoab Ansari Mohammad Shoab Ansari
by Mohammad Shoab Ansari Mohammad Shoab Ansari , Software Developer , Asofttechnotech

Hibernate not work without primary key. Primary key is neccessary. if you not specify a primary key then by default create a primary key. if u delete manualy , hibernate does't work.

More Questions Like This