-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Hibernate validation error
PostPosted: Thu Sep 17, 2009 1:45 pm 
Newbie

Joined: Tue Aug 25, 2009 6:36 am
Posts: 3
Hi,

Working with JPA/Hibernate, I have a quite big "graph" of inter-linked entity-objects, and try to save it to the database.

Calling entityManager.persist(company), I get the validation error below, but not yet able to pinpoint the exact cause of it.

The error-msg complaints abt validation on the Root object (Company),
but I suspect the error is not there, but in one of the many linked child-entities.

1. Just wondered if that is possible, or would the error-msg in that case refer to the sub-entity rather than the Root class?

2. Is there any way I can get Hibernate to tell me more specifically which class & attribute that actually fails to validate?

Best regards,
_________________________

Caused by: org.hibernate.validator.InvalidStateException: validation failed for: entity.Company
at org.hibernate.validator.event.ValidateEventListener.validate(ValidateEventListener.java:148)
at org.hibernate.validator.event.ValidateEventListener.onPreInsert(ValidateEventListener.java:172)
at org.hibernate.action.EntityInsertAction.preInsert(EntityInsertAction.java:178)
at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:72)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:279)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:263)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:167)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1027)
at org.hibernate.ejb.AbstractEntityManagerImpl.flush(AbstractEntityManagerImpl.java:304)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:197)
at $Proxy63.flush(Unknown Source)
at dao.CompanyDAO.saveCompany(CompanyDAO.java:211)


Top
 Profile  
 
 Post subject: Re: Hibernate validation error
PostPosted: Fri Sep 18, 2009 2:48 am 
Newbie

Joined: Tue Aug 25, 2009 6:36 am
Posts: 3
Followup:

Turned out the validation-error was not in an separate linked child-object, but in an "@Embedded" child-object.

Would still be helpful, if Hibernate in the error-mgs above, at least could include the NAME of the attribute that fails validation.

= FEATURE REQUEST :D


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.