This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes Hibernate One To Many Not Null Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Databases » Object Relational Mapping
Reply Bookmark "Hibernate One To Many Not Null" Watch "Hibernate One To Many Not Null" New topic
Author

Hibernate One To Many Not Null

Cristian Daniel Ortiz Cuellar
Ranch Hand

Joined: Feb 02, 2011
Posts: 81
hi guys i am learning hibernate. can somebody give me a hand.

i am trying to implement one to many. relationship unidirectional.
i have the following structure on my database.
laboratorios could have 1..N lineas


Java Code Laboratorios


Java Code Lineas


It works OK. only when in detail table(Linea) linea.codigolaboratorioii line null. (allows NULLS).

if i put linea.codigolaboratorioii as not null. gives me the next error. el valor null para la columna «codigolaboratorioii» viola la restricción not null
the value for the column codigolaboratorioii violate constraint not null.

is wrong put a foreing key as not null???

in others words codigolaboratorioii character varying(15) IS OK.
in others words codigolaboratorioii character varying(15) not null, the value for the column codigolaboratorioii violate constraint not null. .

thanks a lot
Wouter Oet
Saloon Keeper

Joined: Oct 25, 2008
Posts: 2700

Moved to the ORM forum.


"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
Cristian Daniel Ortiz Cuellar
Ranch Hand

Joined: Feb 02, 2011
Posts: 81
Wouter Oet wrote:Moved to the ORM forum.


i post a self explaining video at megaupload http://www.megaupload.com/?d=W0UZK5UL just 1.37 Mb. please watch it.

thanks a lot
Wouter Oet
Saloon Keeper

Joined: Oct 25, 2008
Posts: 2700

Please don't use videos. Just describe your problem.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Hibernate One To Many Not Null
 
Similar Threads
Edit primary key, if it's a foreign key
JPA with onetomany between two tables, each having compound primary keys
how to insert a current date into the databse colunm using hybernate ?
Help me for Joinin two tables.
Outer join between 3 entities in HQL