[Hibernate-JIRA] Created: (HHH-4065) Incorrect SQL is used for HQL if the number of values for a filter collection parameter is changed
by Nicklas Nordborg (JIRA)
Incorrect SQL is used for HQL if the number of values for a filter collection parameter is changed
--------------------------------------------------------------------------------------------------
Key: HHH-4065
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4065
Project: Hibernate Core
Issue Type: Bug
Components: query-hql
Affects Versions: 3.3.2
Environment: Hibernate 3.3.2
Reporter: Nicklas Nordborg
Attachments: trace.txt
I think that maybe the fix for HHH-530 has introduced a problem with filters that has a collection-type parameter. If the number of parameters in that collection changes during the lifetime of a SessionFactory the SQL that is used becomes incorrect and either has too many or too few parameter placeholders (eg. '?') in the SQL. There was no problem in Hibernate 3.3.1. A typical error message is:
java.sql.SQLException: Parameter index out of bounds. 2 is not between valid values of 1 and 1
Below is some pseudo-code that shows what happens when the number of values in a collection is increased from 1 to 2. The 'memberOf' is a simple filter on the `id` column: `id` IN (:items)
String hql = "select n from NewsData n";
List idList = new ArrayList();
idList.add(1);
Session s = .... // create new session
s.enableFilter("memberOf").setParameterList("items", idList);
s.createQuery(hql).list();
// SQL: select .... `News` newsdata0_ where newsdata0_.`id` IN (?)
s.close();
idList.add(2);
s = ... // create new session
s.enableFilter("memberOf").setParameterList("items", idList);
s.createQuery(hql).list(); // <--- error here with 3.3.2 but works with 3.3.1
// SQL (3.3.2): select .... `News` newsdata0_ where newsdata0_.`id` IN (?)
// SQL (3.3.1): select .... `News` newsdata0_ where newsdata0_.`id` IN (?, ?)
I am attaching a file with TRACE-level output from both Hibernate 3.3.2 and 3.3.1. The relevant difference seems to be that in Hibernate 3.3.2 the query plan is cached with:
[SQL_TOKEN] SqlFragment: 'newsdata0_.`id` IN (?)'
but in Hibernate 3.3.1 with:
[SQL_TOKEN] SqlFragment: 'newsdata0_.`id` IN (:memberOf.items)'
--
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
14 years, 5 months
[Hibernate-JIRA] Created: (HV-305) JPATraversableResolver tries to access properties that do not exist
by Stephan Bublava (JIRA)
JPATraversableResolver tries to access properties that do not exist
-------------------------------------------------------------------
Key: HV-305
URL: http://opensource.atlassian.com/projects/hibernate/browse/HV-305
Project: Hibernate Validator
Issue Type: Bug
Affects Versions: 4.1.0.Beta1
Environment: Hibernate Validator 4.1.0.Beta1, Hibernate 3.5.0-Final
Reporter: Stephan Bublava
Assignee: Hardy Ferentschik
Attachments: validation-test.zip
Prerequisites:
- two entities that model a bidirectional 1:n relationship
- both have class-level constraints
- the collection that represent the n-side of the relationship is annotated @Valid
- Hibernate 3.5 is in the class path
In this case, validation of the entity that represents the 1-side fails, because JPATraversableResolver attempts to access a property that doesn't exist. (It looks for the collection in the wrong entity.)
Changing any of the last three conditions makes the problem disappear...
I've attached a test-cases that demonstrates this issue in more detail.
--
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
14 years, 5 months
[Hibernate-JIRA] Created: (HHH-5030) BaseRegionAdapter shouldn't rely on optional Cache#toMap method
by Adrian Hummel (JIRA)
BaseRegionAdapter shouldn't rely on optional Cache#toMap method
---------------------------------------------------------------
Key: HHH-5030
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5030
Project: Hibernate Core
Issue Type: Bug
Components: caching (L2)
Affects Versions: 3.5.0-CR-2
Environment: hibernate-oscache 3.5.0.Beta-1
Reporter: Adrian Hummel
Attachments: bugreport.zip
Get an {{UnsupportedOperationException}} when checking the L2 cache if it contains an entity:
{code}
emf.getCache().contains(MyEntity.class, pk);
{code}
Result:
{code}
java.lang.UnsupportedOperationException
at org.hibernate.cache.OSCache.toMap(OSCache.java:126)
at org.hibernate.cache.impl.bridge.BaseRegionAdapter.contains(BaseRegionAdapter.java:62)
at org.hibernate.impl.SessionFactoryImpl$CacheImpl.containsEntity(SessionFactoryImpl.java:967)
at org.hibernate.impl.SessionFactoryImpl$CacheImpl.containsEntity(SessionFactoryImpl.java:962)
at org.hibernate.ejb.EntityManagerFactoryImpl$JPACache.contains(EntityManagerFactoryImpl.java:164)
...
{code}
The {{Cache#toMap}} method is optional (according to Javadoc), thus, {{BaseRegionAdapter}} shouldn't rely on this method.
--
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
14 years, 5 months
[Hibernate-JIRA] Created: (HHH-5121) Using Oracle analytical functions causes QuerySyntaxException
by Tarek Nabil (JIRA)
Using Oracle analytical functions causes QuerySyntaxException
-------------------------------------------------------------
Key: HHH-5121
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5121
Project: Hibernate Core
Issue Type: Bug
Components: entity-manager
Affects Versions: 3.5.0-Final
Environment: Hibernate 3.5.0-Final.
Oracle 10g.
Reporter: Tarek Nabil
Attachments: criteria-bug.zip
The CriteriaBuilder.function() method allows the creation of an expression which is supported by the target DB such as DB functions.
Using this facility to call Oracle 10g (and above) analytical functions such as "COUNT(*) OVER()" produces a QuerySyntaxException.
The attached test case illustrates the problem. It's a minimal Maven2 project which contains one domain class and one DAO.
The domain class maps to the REGION entity from the Oracle HR schema which ships with any Oracle XE installation. I still included the script needed to create the table incase the schema is not available on the test environment.
The DAO has two methods, one selects all the regions and the other attempts to select all the regions and the count of records returned using "COUNT(*) OVER()". A test class is used to test those two methods; the first test works successfully; the second gives the stack trace provided in "stack-trace.txt".
I believe this bug is a major one because:
1- To get the total count of records, the only other option is to do two queries which is a lot more expensive.
2- The count is required for pagination of results which is essential for search screens.
3- Search screens which require dynamic queries are the main reason one would use criteria in the first place.
I've provided instructions on the changes required to setup the Maven project in order to run the test case, which are minimal, in "readme.txt".
--
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
14 years, 5 months
[Hibernate-JIRA] Created: (HHH-5170) Used unsaved-value="any" for <composite-id>, Getting exception Object references an unsaved transient instance - save the transient instance before flushing, even though record exist in the DB
by Deepesh Seetharaman (JIRA)
Used unsaved-value="any" for <composite-id>, Getting exception Object references an unsaved transient instance - save the transient instance before flushing, even though record exist in the DB
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Key: HHH-5170
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5170
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.2.3
Environment: DB2-z Series, Weblogic 10.3 App Server.
Reporter: Deepesh Seetharaman
Attachments: EventService.hbm.xml, State.hbm.xml, test.zip
I have attached the following files.
i)EventService.hbm.xml
ii)State.hbm.xml
While I am trying to persist, EventService, by setting the State object, with only its id fields its giving the folloiwing exception.
org.springframework.dao.InvalidDataAccessApiUsageException: object references an unsaved transient instance - save the transient instance before flushing: com.fareis.las.css.sys.rf.domain.State; nested exception is org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: com.fareis.las.css.sys.rf.domain.State
Caused by: org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: com.fareis.las.css.sys.rf.domain.State
at org.hibernate.engine.ForeignKeys.getEntityIdentifierIfNotUnsaved(ForeignKeys.java:219)
at org.hibernate.type.EntityType.getIdentifier(EntityType.java:397)
at org.hibernate.type.ManyToOneType.isDirty(ManyToOneType.java:242)
at org.hibernate.type.TypeFactory.findDirty(TypeFactory.java:576)
at org.hibernate.persister.entity.AbstractEntityPersister.findDirty(AbstractEntityPersister.java:3121)
at org.hibernate.event.def.DefaultFlushEntityEventListener.dirtyCheck(DefaultFlushEntityEventListener.java:472)
at org.hibernate.event.def.DefaultFlushEntityEventListener.isUpdateNecessary(DefaultFlushEntityEventListener.java:197)
at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:120)
at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:196)
at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:76)
at org.hibernate.event.def.DefaultAutoFlushEventListener.onAutoFlush(DefaultAutoFlushEventListener.java:35)
at org.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:969)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1114)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
at org.springframework.orm.hibernate3.HibernateTemplate$29.doInHibernate(HibernateTemplate.java:849)
at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:372)
at org.springframework.orm.hibernate3.HibernateTemplate.find(HibernateTemplate.java:840)
at org.springframework.orm.hibernate3.HibernateTemplate.find(HibernateTemplate.java:836)
at com.fareis.core.pf.repository.hibernate.GenericHibernateRepository.findByProperty(GenericHibernateRepository.java:417)
at com.fareis.las.prc.clb.el.repository.hibernate.EventHibernateRepository.findByClientBillingEventKey(EventHibernateRepository.java:42)
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.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:296)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:177)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:144)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:166)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy1.findByClientBillingEventKey(Unknown Source)
at com.fareis.prc.clb.repository.test.BillableEventRepositoryTestCase.testAddEvent(BillableEventRepositoryTestCase.java:83)
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 junit.framework.TestCase.runTest(TestCase.java:164)
at junit.framework.TestCase.runBare(TestCase.java:130)
at org.springframework.test.ConditionalTestCase.runBare(ConditionalTestCase.java:69)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:120)
at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
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)
I am creating the instance like this.
EventService service = new EventService();
State state = new State();
StateId id = new StateId();
id.setStateCode("DAS");
Country country = new Country();
country.setCountryCode("US");
id.setCountryCode(country);
state.setId(id);
service.setBillingId(10);
service.setStatusCode("A");
service.setState(state);
service.setClientBillingEventKey(clientBillingEvent);
service.setLastUpdateSourceId("TEST");
service.setLastUpdateTimestamp(new java.util.Date());
service.setLastUpdateUserId("sdeepesh");
service.setCorrDate(new Date(System.currentTimeMillis()));
service.set ... other not-null fields.
State.hbm.xml's <id property is using unsaved-value="any", if you remove that attribute everything works fine, but it will fire a SELECT SQL to the STATE table, to verify the integrity of the <id>.
We had explicitly mentioned the unsaved-value="any", in order to prevent the SELECT being fired.
Ironicall I found out that when you make unsaved-value="none", everything works perfectly, but then unsaved-value is having this unpredictable behaviour about it's value.
We are using unsaved-value attribute for all <id, <composite-id which has <generated-class as "assigned", the values are like below
<id unsaved-value="id_value" - id is a String
<id unsaved-value="none" - id is a Integer
<composite-id unsaved-value="any"
For composite-id everywhere we used, unsaved-value="any", the only contradicting place where we found is with State.hbm.xml
If possible please provide some guidelines as to use the "unsaved-value", we mainly used that to prevent the SELECT SQLs from executing before performing INSERT.
Also while debugging through the hibernate code, I found that it is performing dirtyCheck for EventService instance, where it compares loaded value and current value.
I found that loaded value was having State object as null.
Please provde your comments.
I have also attached the test cases, but you wont able to run it, due to compilation problems,
testAddEvent is the one which is failing
--
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
14 years, 5 months
[Hibernate-JIRA] Created: (HHH-5164) HQL putting quotes around SMALLINT field
by Shawn Kuenzler (JIRA)
HQL putting quotes around SMALLINT field
----------------------------------------
Key: HHH-5164
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5164
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.3.1
Environment: Hibernate 3.3.1 using org.hibernate.dialect.DB2Dialect against DB2 v9.1
Reporter: Shawn Kuenzler
HQL query generating a WHERE clause with a mapped column of java type "int" and datatype "SMALLINT" in DB2. The generated prepared statement inside of AbstractBatcher.class shows single quotes around the value (i.e. '11'). DB2 complains with a "SQL0401N The data types of the operands for the operation "=" are not compatible." error. Running the query in the DB2 Command Center I see it just needs the quotes removed.
I see that in SQLServer 2008, where the same legacy database field has a datatype of "TINYINT", SQLServer is accepting of the single quoted value in the HQL statement.
--
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
14 years, 5 months
[Hibernate-JIRA] Created: (HSEARCH-503) Generated archetype broken for any package name with dot (.)
by G Fernandes (JIRA)
Generated archetype broken for any package name with dot (.)
------------------------------------------------------------
Key: HSEARCH-503
URL: http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-503
Project: Hibernate Search
Issue Type: Patch
Components: build
Affects Versions: 3.2.0.Beta1
Reporter: G Fernandes
Priority: Minor
Steps to reproduce:
=====================
$ cd hibernate-search-archetype
$ mvn archetype:create-from-project -Darchetype.properties=src/main/archetype/archetype.properties
...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4 seconds
[INFO] Finished at: Sat Apr 10 20:35:58 BST 2010
[INFO] Final Memory: 16M/80M
[INFO] ------------------------------------------------------------------------
$ cd target/generate-sources/archetype
$ mvn install
...
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3 seconds
[INFO] Finished at: Sat Apr 10 20:36:50 BST 2010
[INFO] Final Memory: 18M/80M
[INFO] ------------------------------------------------------------------------
$ cd ~/temp
$ mvn archetype:generate -DarchetypeGroupId=org.hibernate -DarchetypeArtifactId=hibernate-search-quickstart -DarchetypeVersion=3.2.0-SNAPSHOT -DgroupId=my.company -DartifactId=quickstart -Dversion=1.0-SNAPSHOT
...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5 seconds
[INFO] Finished at: Sat Apr 10 20:39:17 BST 2010
[INFO] Final Memory: 13M/79M
[INFO] ------------------------------------------------------------------------
$ cd quickstart
$ mvn install
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /Users/gustavo/temp/quickstart/src/main/java/com/mycomany/Book.java:[25,11] ';' expected
[ERROR] /Users/gustavo/temp/quickstart/src/main/java/com/mycomany/Book.java:[37,10] '.' expected
[ERROR] /Users/gustavo/temp/quickstart/src/main/java/com/mycomany/Book.java:[37,11] ';' expected
[ERROR] /Users/gustavo/temp/quickstart/src/main/java/com/mycomany/Book.java:[37,19] class, interface, or enum expected
[ERROR] /Users/gustavo/temp/quickstart/src/main/java/com/mycomany/Book.java:[37,20] class, interface, or enum expected
[ERROR] /Users/gustavo/temp/quickstart/src/main/java/com/mycomany/Author.java:[25,11] ';' expected
--
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
14 years, 5 months
[Hibernate-JIRA] Created: (HHH-4909) Null Pointer Exception When Usding Spring 3.0 with Hibernate 3.5.0-Beta-x
by Petar Tahchiev (JIRA)
Null Pointer Exception When Usding Spring 3.0 with Hibernate 3.5.0-Beta-x
-------------------------------------------------------------------------
Key: HHH-4909
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4909
Project: Hibernate Core
Issue Type: Bug
Components: entity-manager
Affects Versions: 3.5.0-CR-1, 3.5.0-Beta-4, 3.5.0-Beta-3, 3.5.0-Beta-2, 3.5.0.Beta-1
Environment: Java, 1.6, Spring 3.0.0 (tested also with 3.0.1.SNAPSHOT)
Reporter: Petar Tahchiev
Priority: Critical
Attachments: stacktrace.txt
Hi guys,
I had an application working fine with OpenJPA, but I decided to migrate to Hibernate and I get a Null pointer exception (see the attached stacktrace).
Let me know if you need some other info. My configuration is below:
persistence.xml:
===========================================
===========================================
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
<persistence-unit name="frontend-ui">
<class>com.fugsley.beech.betting.db.model.User</class>
.........[more here]...................
<!-- provider>org.hibernate.ejb.HibernatePersistence</provider>
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider-->
<properties>
<!-- OpenJPA configuration -->
<!-- property name="openjpa.ConnectionURL" value="jdbc:mysql://localhost:3306/fugsley?useUnicode=true&characterEncoding=UTF-8"/>
<property name="openjpa.ConnectionDriverName" value="com.mysql.jdbc.Driver"/>
<property name="openjpa.ConnectionUserName" value="fugsley"/>
<property name="openjpa.ConnectionPassword" value="r00tka"/>
<property name="openjpa.DetachState" value="DetachedStateField=true"/>
<property name="openjpa.Log" value="DefaultLevel=INFO, Tool=INFO"/> -->
<!-- configuration pool via c3p0-->
<property name="c3p0.acquire_increment" value="1"/>
<property name="c3p0.idle_test_period" value="100"/> <!-- seconds -->
<property name="c3p0.min_size" value="5"/>
<property name="c3p0.max_size" value="20"/>
<property name="c3p0.timeout" value="1800"/>
<property name="c3p0.max_statements" value="50"/>
<!-- Hibernate configuration -->
<property name="hibernate.archive.autodetection" value="class, hbm"/>
<property name="hibernate.show_sql" value="false"/>
<property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>
<property name="hibernate.connection.password" value="r00tka"/>
<property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/fugsley?useUnicode=true&characterEncoding=UTF-8"/>
<property name="hibernate.connection.username" value="fugsley"/>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
<property name="hibernate.c3p0.min_size" value="5"/>
<property name="hibernate.c3p0.max_size" value="20"/>
<property name="hibernate.c3p0.timeout" value="300"/>
<property name="hibernate.c3p0.max_statements" value="50"/>
<property name="hibernate.c3p0.idle_test_period" value="3000"/>
</properties>
</persistence-unit>
</persistence>
===============spring-application-context===========================
<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="loadTimeWeaver">
<bean
class="org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver" />
</property>
<property name="dataSource" ref="beechDataSource" />
<property name="jpaVendorAdapter">
<bean
class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
<property name="database" value="Mysql" />
<property name="showSql" value="false" />
</bean>
</property>
</bean>
--
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
14 years, 5 months
[Hibernate-JIRA] Created: (EJB-463) Merging of one-to-many relations not JPA spec compliant for lazy relations
by Dirk (JIRA)
Merging of one-to-many relations not JPA spec compliant for lazy relations
--------------------------------------------------------------------------
Key: EJB-463
URL: http://opensource.atlassian.com/projects/hibernate/browse/EJB-463
Project: Hibernate Entity Manager
Issue Type: Bug
Affects Versions: 3.4.0.GA
Environment: Hibernate 3.2.6, Hibernate EntityManager 3.4.0, Hibernate Annotations 3.4.0, Oracle
Reporter: Dirk
Attachments: CascadeTest.zip
Topic has been posted to the Hibernate Forum. See https://forum.hibernate.org/viewtopic.php?f=1&t=999398
Summary:
Suppose you have an object Master with one-to-many relation to Detail.
@Entity
public class Master implements Serializable {
@OneToMany(mappedBy = "master", cascade={CascadeType.MERGE, CascadeType.PERSIST})
private List<Detail> details = new ArrayList<Detail>();
...
}
Master is loaded without fetching Detail (= lazy) and EntityManager is closed. Master is now in detached state. Merging Master causes Hibernate EntityManager to eagerly load the Detail collection although it is in lazy state. This is not JPA spec compliant.
JPA spec states: The persistence provider must not merge fields marked LAZY that have not been fetched: it must ignore
such fields when merging. See 3.2.4.1 Merging Detached Entity State, p.51.
Tested also with the latest version of EclipseLink. EclipseLink behaves as expected.
Testcase attached (Netbeans 6.7).
--
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
14 years, 5 months