| Author |
Hibernate: "not-null property references a null or transient value" only with HSQL
|
Alvaro Victor Cavalcanti
Greenhorn
Joined: Jun 15, 2005
Posts: 2
|
|
Hi Guys,
I have an already release software that makes use of Hibernate+Postgre, and now I have to make it compatible ALSO with HSQL.
All in all, I managed to get everything working, except the following issue. I have a Product and a ProductDetail entities. And the latter has a reference to the former and everything works like a charm on Postgre. When I create a product (and proddetails) the Hibernate can save them. But when I use the HSQL, it flops:
not-null property references a null or transient value: xx.xxx.xxxx.product.ProductDetail.product
But the thing is, I've inspected the entity on the line:
HibernateUtil.getSession().saveOrUpdate(entity);
And it is a ProductDetail, and its product field IS NOT EMPTY. It contains a valid Product object. And that is no surprise, as I've already written it works with Postgre.
Any clues?
|
Systems Analyst<br />FPF - <a href="http://www.fpf.br<br" target="_blank" rel="nofollow">www.fpf.br<br</a> />SCJP 1.4<br />Manaus - AM - Brazil
|
 |
Manuel Petermann
Ranch Hand
Joined: Jul 19, 2011
Posts: 175
|
|
I think we need your mapping for the entities related to your problem.
Maybe you are trying to save an unsaved entity and you forgot a cascade.
|
Please correct my English.
|
 |
Alvaro Victor Cavalcanti
Greenhorn
Joined: Jun 15, 2005
Posts: 2
|
|
I don't think that's the problem, since it works with Postgres. But here it goes (some parts were ommited due to confidentiality):
ProductDetail.hbm.xml
Product.hbm.xml
|
 |
 |
|
|
subject: Hibernate: "not-null property references a null or transient value" only with HSQL
|
|
|