[Hibernate-JIRA] Created: (HHH-2310) LazyInitializationException: Initializing many-to-one and one-to-one associations to a maximum of max-fetch-depth fails when using a SQLProjection on a Criteria generated Query
by Nico De Groote (JIRA)
LazyInitializationException: Initializing many-to-one and one-to-one associations to a maximum of max-fetch-depth fails when using a SQLProjection on a Criteria generated Query
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Key: HHH-2310
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2310
Project: Hibernate3
Type: Bug
Components: core
Versions: 3.0.5
Reporter: Nico De Groote
Priority: Critical
Initializing many-to-one and one-to-one associations to a maximum of max-fetch-depth fails when using a SQLProjection on a Criteria generated Query
Following scenario occurs.
I have a max-fetch-depth = default value.
I have a the following businessobject having the following associations.
BO -> BO2 (One to one)
BO -> list of BO3 (one to many)
I want to query for BO objects with the where clause containing a condition on one of the properties of the BO3 objects.
When I now generate my query via the Criteria API and having the following projection set to retrieve only my BO objects (and none of the outer joinables)
Projection projection = Projections.sqlProjection(
"{alias}." + primaryKeyColumn + " theObj__", new String[]{"theObj__"},
new Type[]{Hibernate.entity(BO.getClass())});
I get my BO objects but the BO2 object is not initialized, as it should ne because of the max-fetch-depth.
When not using the Projection I do get the one-to-one relation (BO2 object) as the max-fetch-depth is default value, but the query takes too much time because of the non required properties for the outerjoinable associations in the select clause.
It seams that the fetching of the many-to-one and the one-to-one associations for the max-fetch-depth is disabled when using projections.
Or am I missing the point here?
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
15 years, 11 months
[Hibernate-JIRA] Created: (HV-62) Embedded class used twice in a Entity, once validating and another don't.
by Raoni Fortes Normanton (JIRA)
Embedded class used twice in a Entity, once validating and another don't.
-------------------------------------------------------------------------
Key: HV-62
URL: http://opensource.atlassian.com/projects/hibernate/browse/HV-62
Project: Hibernate Validator
Issue Type: Bug
Affects Versions: 3.0.0.ga
Environment: Running with:
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-annotations</artifactId>
<version>3.3.0.ga</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>3.0.0.GA</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>3.3.1.ga</version>
</dependency>
Reporter: Raoni Fortes Normanton
Attachments: Address.java, Customer.java, CustomerTest.java
My Customer class has two address (embedded), one must be validated, the other dont.
When the address2 is null, the validation works. But when the empty instance is setted, the persist crashes.
Validating by ClassValidator works fine. But when I call the em.persist() in service, the exception is throwed:
javax.ejb.EJBException: nested exception is: org.hibernate.validator.InvalidStateException: validation failed for: br.com.kinomaxx.kinosystem.Customer
org.hibernate.validator.InvalidStateException: validation failed for: br.com.kinomaxx.kinosystem.Customer
at org.hibernate.validator.event.ValidateEventListener.validate(ValidateEventListener.java:148)
at org.hibernate.validator.event.ValidateEventListener.onPreInsert(ValidateEventListener.java:172)
at org.hibernate.action.EntityIdentityInsertAction.preInsert(EntityIdentityInsertAction.java:119)
at org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:42)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:248)
at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:290)
at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:180)
at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:108)
at org.hibernate.ejb.event.EJB3PersistEventListener.saveWithGeneratedId(EJB3PersistEventListener.java:49)
at org.hibernate.event.def.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:131)
at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:87)
at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:38)
at org.hibernate.impl.SessionImpl.firePersist(SessionImpl.java:618)
at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:592)
at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:596)
at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:213)
at br.com.kinomaxx.kinosystem.dao.EntityManagerWrapperBean.persist(EntityManagerWrapperBean.java:52)
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:585)
at org.mycontainer.kernel.reflect.proxy.ProxyChainImpl.proceed(ProxyChainImpl.java:45)
at org.mycontainer.jpa.PersistenceContextInterceptor.intercept(PersistenceContextInterceptor.java:53)
at org.mycontainer.kernel.reflect.proxy.ProxyChainImpl.proceed(ProxyChainImpl.java:35)
at org.mycontainer.kernel.interceptors.NamingInjectInterceptor.intercept(NamingInjectInterceptor.java:48)
at org.mycontainer.kernel.reflect.proxy.ProxyChainImpl.proceed(ProxyChainImpl.java:35)
at org.mycontainer.kernel.interceptors.NamingInjectInterceptor.intercept(NamingInjectInterceptor.java:48)
at org.mycontainer.kernel.reflect.proxy.ProxyChainImpl.proceed(ProxyChainImpl.java:35)
at org.mycontainer.ejb.interceptor.EJBContextInterceptor.intercept(EJBContextInterceptor.java:55)
at org.mycontainer.kernel.reflect.proxy.ProxyChainImpl.proceed(ProxyChainImpl.java:35)
at org.mycontainer.ejb.transaction.RequiredTransactionHandler.intercept(RequiredTransactionHandler.java:38)
at org.mycontainer.ejb.interceptor.TransactionInterceptor.intercept(TransactionInterceptor.java:52)
at org.mycontainer.kernel.reflect.proxy.ProxyChainImpl.proceed(ProxyChainImpl.java:35)
at org.mycontainer.ejb.interceptor.EJBExceptionInterceptor.intercept(EJBExceptionInterceptor.java:27)
at org.mycontainer.kernel.reflect.proxy.ProxyChainImpl.proceed(ProxyChainImpl.java:35)
at org.mycontainer.kernel.reflect.proxy.ProxyEngine.invoke(ProxyEngine.java:77)
at $Proxy33.persist(Unknown Source)
at br.com.kinomaxx.kinosystem.CustomerTest.test(CustomerTest.java:50)
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:585)
at org.junit.internal.runners.TestMethodRunner.executeMethodBody(TestMethodRunner.java:99)
at org.junit.internal.runners.TestMethodRunner.runUnprotected(TestMethodRunner.java:81)
at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
at org.junit.internal.runners.TestMethodRunner.runMethod(TestMethodRunner.java:75)
at org.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:45)
at org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(TestClassMethodsRunner.java:71)
at org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:35)
at org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42)
at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
javax.ejb.EJBException: nested exception is: org.hibernate.validator.InvalidStateException: validation failed for: br.com.kinomaxx.kinosystem.Customer
at org.mycontainer.ejb.interceptor.EJBExceptionInterceptor.intercept(EJBExceptionInterceptor.java:31)
at org.mycontainer.kernel.reflect.proxy.ProxyChainImpl.proceed(ProxyChainImpl.java:35)
at org.mycontainer.kernel.reflect.proxy.ProxyEngine.invoke(ProxyEngine.java:77)
at $Proxy33.persist(Unknown Source)
at br.com.kinomaxx.kinosystem.CustomerTest.test(CustomerTest.java:50)
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:585)
at org.junit.internal.runners.TestMethodRunner.executeMethodBody(TestMethodRunner.java:99)
at org.junit.internal.runners.TestMethodRunner.runUnprotected(TestMethodRunner.java:81)
at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
at org.junit.internal.runners.TestMethodRunner.runMethod(TestMethodRunner.java:75)
at org.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:45)
at org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(TestClassMethodsRunner.java:71)
at org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:35)
at org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42)
at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
15 years, 11 months
[Hibernate-JIRA] Created: (HV-60) Need Property names along with validation messages (as an option)
by Priya M (JIRA)
Need Property names along with validation messages (as an option)
-----------------------------------------------------------------
Key: HV-60
URL: http://opensource.atlassian.com/projects/hibernate/browse/HV-60
Project: Hibernate Validator
Issue Type: New Feature
Reporter: Priya M
Forum Tracking.
htthttp://www.seamframework.org/Community/ValidationMessagesWithActualPro...
Currently, the validation messages don't point to the property name(s) making it too generic and hard to understand. For example, let's say I have 10 properties on the page and there were 3 validations thrown by Hibernate Validator. I get the following messages
. value is required
. value is required
. length should be 20
The above messages is only useful for simple forms where each field is wrapped by an error tag. While working with complex UI (datatables with large rows)
and Application code that works with collections, the above messages are redundant if not attached with the corresponding property name.
Ideally, it would be useful to have something like this
. foo value is required
. bar value is required
. foobar length should be 20
This could be provided as an optional hibernate attribute in the hibernate properties
hibernate.validator.include_property_names=true
The only workaround that seems now, is to override each and every validation message in all the entity objects to spit out the property name with validation maessages. (lame!)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
15 years, 11 months
[Hibernate-JIRA] Created: (HV-52) unified unit testing pattern for standalone validators
by Sanne Grinovero (JIRA)
unified unit testing pattern for standalone validators
------------------------------------------------------
Key: HV-52
URL: http://opensource.atlassian.com/projects/hibernate/browse/HV-52
Project: Hibernate Validator
Issue Type: Patch
Affects Versions: 3.0.0.ga
Reporter: Sanne Grinovero
Priority: Minor
Attachments: validator-testing-cleanup.patch
Hi,
I've seen some bugs in the validator I would like to help solving, but the main issue I've seen is that to
write unittests the code is quite verbose; the consequence is that mission-critical code is well tested
but most trivial code is untested.
It looks like to me that most JIRA issues here are relevant to this "untested trivial" code...
I would appreciate if you could apply this patch that greatly simplifies writing of unit tests for standalone validators,
as I would like to send some more patches using this code to develop test-first.
This affects only the "test" source, diffed from 3.0.0.GA, and includes some new testing of
@NotEmpty and @Digits; I would add much more tests if you're not against it.
With "standalone validators" i mean that this is not useful for graph/integration testing,
just each validator on some property.
Sanne
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
15 years, 11 months
[Hibernate-JIRA] Created: (HV-42) Reference Documentation: broken example
by Robert Spielmann (JIRA)
Reference Documentation: broken example
---------------------------------------
Key: HV-42
URL: http://opensource.atlassian.com/projects/hibernate/browse/HV-42
Project: Hibernate Validator
Issue Type: Bug
Components: documentation
Reporter: Robert Spielmann
Priority: Trivial
The Hibernate Validator Reference Guide (Hibernate Validator 3.0.0.GA) contains examples for writing custom annotations and validators, section 1.4 "writing your own constraints". There, it says that the class CapitalizedValidator implements Validator<Capitalized> and PropertyConstraint. The example class, however, does not implement the "apply" method. Thus, the example class does not compile.
Additionally, the class "Capitalize" (containing constants like FIRST) is not defined anywhere. This leaves the example incomplete and thus - unless you quickly implement this class - unsuable for practical experiments.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
15 years, 11 months
[Hibernate-JIRA] Created: (HV-25) Generated DDL ignores Validator annotations on component fields and superclass fields
by Ben Anderson (JIRA)
Generated DDL ignores Validator annotations on component fields and superclass fields
-------------------------------------------------------------------------------------
Key: HV-25
URL: http://opensource.atlassian.com/projects/hibernate/browse/HV-25
Project: Hibernate Validator
Issue Type: Bug
Components: engine
Affects Versions: 3.0.0.ga
Environment: Windows XP, Hibernate 3.2.4.sp1, Hibernate Annotations 3.3.0.ga, Postgres, HSQL
Reporter: Ben Anderson
Attachments: model.zip
The DDL generated for entities containing components or superclass properties does not reflect any Validator length restrictions or not-null constraints that have been defined on those component or superclass properties i.e. a component with a property containing the @Length(max = 50) and @NotNull annotation is generated as varchar(255) with nulls permitted (at the database level).
I've posted a more detailed example to the forum at http://forum.hibernate.org/viewtopic.php?t=975612
Another example can be found at http://www.ibm.com/developerworks/web/library/j-hibval.html - the SQL generated when this schema is exported is:
create table cc (id integer not null, fname varchar(255), mi varchar(255), lname varchar(255), addr1 varchar(255), addr2 varchar(255), city varchar(255), zipcode varchar(255), state_id varchar(255), cvv2 varchar(6) not null, expiration_date timestamp not null, type_id integer not null, num varchar(30) not null, customer_id integer not null, primary key (id));
create table customer (id integer not null, dob timestamp, phone varchar(255), fax varchar(255), email varchar(255), fname varchar(255), mi varchar(255), lname varchar(255), addr1 varchar(255), addr2 varchar(255), city varchar(255), zipcode varchar(255), state_id varchar(255), primary key (id));
The SQL should be:
create table cc (id integer not null, fname varchar(30) not null, mi varchar(1), lname varchar(30) not null, addr1 varchar(50) not null, addr2 varchar(50), city varchar(50) not null, zipcode varchar(15) not null, state_id varchar(2) not null, cvv2 varchar(6) not null, expiration_date timestamp not null, type_id integer not null, num varchar(30) not null, customer_id integer not null, primary key (id));
create table customer (id integer not null, dob timestamp, phone varchar(13), fax varchar(13), email varchar(40), fname varchar(30) not null, mi varchar(1), lname varchar(30) not null, addr1 varchar(50) not null, addr2 varchar(50) not null, city varchar(50) not null, zipcode varchar(15) not null, state_id varchar(2) not null, primary key (id));
I've attached the relevant classes from this example.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
15 years, 11 months