aspose file tools*
The moose likes Object Relational Mapping and the fly likes Hibernate One To Many Not Null Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Hibernate One To Many Not Null