[Hibernate-JIRA] Resolved: (HHH-1468) No Dialect mapping for JDBC type: 3 Exception
by Gail Badner (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1468?page=c... ]
Gail Badner resolved HHH-1468.
------------------------------
Assignee: Gail Badner
Resolution: Duplicate
> No Dialect mapping for JDBC type: 3 Exception
> ---------------------------------------------
>
> Key: HHH-1468
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1468
> Project: Hibernate Core
> Issue Type: Bug
> Reporter: Bhumika Thakkar
> Assignee: Gail Badner
>
> I get an exception when the following native query returns a decimal type.
>
> sample code
> @SqlResultSetMapping(name = "scalar", columns = @ColumnResult(name = "amount"))
> @NamedNativeQuery(name = "getAmount", query = "select sum(amount) as amount from billing where id=1", resultSetMapping = "scalar")
> $RCSfile: ExceptionHandler.java,v $.execute Exception
> org.hibernate.MappingException: No Dialect mapping for JDBC type: 3
> at org.hibernate.dialect.TypeNames.get(TypeNames.java:56)
> at org.hibernate.dialect.TypeNames.get(TypeNames.java:81)
> at org.hibernate.dialect.Dialect.getHibernateTypeName(Dialect.java:192)
> at org.hibernate.loader.custom.CustomLoader.getHibernateType(CustomLoader.jav
> a:170)
> at org.hibernate.loader.custom.CustomLoader.autoDiscoverTypes(CustomLoader.ja
> va:152)
> at org.hibernate.loader.Loader.getResultSet(Loader.java:1678)
> at org.hibernate.loader.Loader.doQuery(Loader.java:662)
> at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.
> java:224)
> at org.hibernate.loader.Loader.doList(Loader.java:2150)
> at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029)
> at org.hibernate.loader.Loader.list(Loader.java:2024)
> at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:117)
> at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1672)
> at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:147)
> at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:169)
> at org.springframework.orm.hibernate3.HibernateTemplate$33.doInHibernate(Hibe
> rnateTemplate.java:920)
> at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemp
> late.java:365)
> at org.springframework.orm.hibernate3.HibernateTemplate.findByNamedQueryAndNa
> medParam(HibernateTemplate.java:911)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
> 39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorIm
> pl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(Ao
> pUtils.java:335)
> at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoi
> nt(ReflectiveMethodInvocation.java:181)
> at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(Refle
> ctiveMethodInvocation.java:148)
> at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(
> TransactionInterceptor.java:96)
> at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(Refle
> ctiveMethodInvocation.java:170)
> at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopP
> roxy.java:176)
> at $Proxy76.getTotalLeadPayout(Unknown Source)
> at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProc
> essor.java:419)
> at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:22
> 4)
> at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
> at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:115)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:92)
> at com.caucho.server.dispatch.ServletFilterChain.doFilter(ServletFilterChain.
> java:99)
> at com.caucho.server.security.SecurityFilterChain.doFilter(SecurityFilterChai
> n.java:135)
> at com.caucho.server.cache.CacheFilterChain.doFilter(CacheFilterChain.java:20
> 9)
> at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java
> :163)
> at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.jav
> a:208)
> at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:259)
> at com.caucho.server.port.TcpConnection.run(TcpConnection.java:363)
> at com.caucho.util.ThreadPool.runTasks(ThreadPool.java:490)
> at com.caucho.util.ThreadPool.run(ThreadPool.java:423)
> at java.lang.Thread.run(Thread.java:595)
> $RCSfile: ExceptionHandler.java,v $.execute Exception Cause 1
> org.hibernate.MappingException: No Dialect mapping for JDBC type: 3
> at org.hibernate.dialect.TypeNames.get(TypeNames.java:56)
> at org.hibernate.dialect.TypeNames.get(TypeNames.java:81)
> at org.hibernate.dialect.Dialect.getHibernateTypeName(Dialect.java:192)
> at org.hibernate.loader.custom.CustomLoader.getHibernateType(CustomLoader.jav
> a:170)
> at org.hibernate.loader.custom.CustomLoader.autoDiscoverTypes(CustomLoader.ja
> va:152)
> at org.hibernate.loader.Loader.getResultSet(Loader.java:1678)
> at org.hibernate.loader.Loader.doQuery(Loader.java:662)
> at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.
> java:224)
> at org.hibernate.loader.Loader.doList(Loader.java:2150)
> at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029)
> at org.hibernate.loader.Loader.list(Loader.java:2024)
> at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:117)
> at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1672)
> at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:147)
> at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:169)
> at org.springframework.orm.hibernate3.HibernateTemplate$33.doInHibernate(Hibe
> rnateTemplate.java:920)
> at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemp
> late.java:365)
> at org.springframework.orm.hibernate3.HibernateTemplate.findByNamedQueryAndNa
> medParam(HibernateTemplate.java:911)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
> 39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorIm
> pl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(Ao
> pUtils.java:335)
> at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoi
> nt(ReflectiveMethodInvocation.java:181)
> at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(Refle
> ctiveMethodInvocation.java:148)
> at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(
> TransactionInterceptor.java:96)
> at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(Refle
> ctiveMethodInvocation.java:170)
> at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopP
> roxy.java:176)
> at $Proxy76.getTotalLeadPayout(Unknown Source)
> at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProc
> essor.java:419)
> at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:22
> 4)
> at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
> at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:115)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:92)
> at com.caucho.server.dispatch.ServletFilterChain.doFilter(ServletFilterChain.
> java:99)
> at com.caucho.server.security.SecurityFilterChain.doFilter(SecurityFilterChai
> n.java:135)
> at com.caucho.server.cache.CacheFilterChain.doFilter(CacheFilterChain.java:20
> 9)
> at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java
> :163)
> at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.jav
> a:208)
> at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:259)
> at com.caucho.server.port.TcpConnection.run(TcpConnection.java:363)
> at com.caucho.util.ThreadPool.runTasks(ThreadPool.java:490)
> at com.caucho.util.ThreadPool.run(ThreadPool.java:423)
> at java.lang.Thread.run(Thread.java:595)
--
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, 7 months
[Hibernate-JIRA] Created: (HHH-2881) PersistantBag.initializeFromCache can be intercepted by CollectionLoadContext.getLoadingCollection and so corrupt the collection
by Pavol Zibrita (JIRA)
PersistantBag.initializeFromCache can be intercepted by CollectionLoadContext.getLoadingCollection and so corrupt the collection
--------------------------------------------------------------------------------------------------------------------------------
Key: HHH-2881
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2881
Project: Hibernate3
Issue Type: Bug
Environment: Hibernate Entity Manager 3.3.1 GA, oracle,
Reporter: Pavol Zibrita
It can occur that while PersistenBag.initializeFromCache is called to populate the collection from cache, the collection is populated also from CollectionLoadContext.getLoadingCollection, and so, the collection is filled with more data than needed. As the initializeFromCache uses direct access to the property this.bag, it will continue loading the collection. Here is the stack trace of what happens:
PersistentBag.beforeInitialize(CollectionPersister, int) line: xx //here is the same collection reinitialized again, and loaded again
CollectionLoadContext.getLoadingCollection(CollectionPersister, Serializable) line: 127
EntityLoader(Loader).readCollectionElement(Object, Serializable, CollectionPersister, CollectionAliases, ResultSet, SessionImplementor) line: 1003
EntityLoader(Loader).readCollectionElements(Object[], ResultSet, SessionImplementor) line: 646
EntityLoader(Loader).getRowFromResultSet(ResultSet, SessionImplementor, QueryParameters, LockMode[], EntityKey, List, EntityKey[], boolean) line: 591
EntityLoader(Loader).doQuery(SessionImplementor, QueryParameters, boolean) line: 701
EntityLoader(Loader).doQueryAndInitializeNonLazyCollections(SessionImplementor, QueryParameters, boolean) line: 236
EntityLoader(Loader).loadEntity(SessionImplementor, Object, Type, Object, String, Serializable, EntityPersister) line: 1860
EntityLoader(AbstractEntityLoader).load(SessionImplementor, Object, Object, Serializable) line: 48
EntityLoader(AbstractEntityLoader).load(Serializable, Object, SessionImplementor) line: 42
SingleTableEntityPersister(AbstractEntityPersister).load(Serializable, Object, LockMode, SessionImplementor) line: 3044
DefaultLoadEventListener.loadFromDatasource(LoadEvent, EntityPersister, EntityKey, LoadEventListener$LoadType) line: 395
DefaultLoadEventListener.doLoad(LoadEvent, EntityPersister, EntityKey, LoadEventListener$LoadType) line: 375
DefaultLoadEventListener.load(LoadEvent, EntityPersister, EntityKey, LoadEventListener$LoadType) line: 139
DefaultLoadEventListener.proxyOrLoad(LoadEvent, EntityPersister, EntityKey, LoadEventListener$LoadType) line: 195
DefaultLoadEventListener.onLoad(LoadEvent, LoadEventListener$LoadType) line: 103
SessionImpl.fireLoad(LoadEvent, LoadEventListener$LoadType) line: 878
SessionImpl.internalLoad(String, Serializable, boolean, boolean) line: 846
ManyToOneType(EntityType).resolveIdentifier(Serializable, SessionImplementor) line: 557
ManyToOneType.assemble(Serializable, SessionImplementor, Object) line: 196
TypeFactory.assemble(Serializable[], Type[], SessionImplementor, Object) line: 420
CacheEntry.assemble(Serializable[], Object, Serializable, EntityPersister, Interceptor, EventSource) line: 96
CacheEntry.assemble(Object, Serializable, EntityPersister, Interceptor, EventSource) line: 82
DefaultLoadEventListener.assembleCacheEntry(CacheEntry, Serializable, EntityPersister, LoadEvent) line: 553
DefaultLoadEventListener.loadFromSecondLevelCache(LoadEvent, EntityPersister, LoadEventListener$LoadType) line: 508
DefaultLoadEventListener.doLoad(LoadEvent, EntityPersister, EntityKey, LoadEventListener$LoadType) line: 357
DefaultLoadEventListener.load(LoadEvent, EntityPersister, EntityKey, LoadEventListener$LoadType) line: 139
DefaultLoadEventListener.proxyOrLoad(LoadEvent, EntityPersister, EntityKey, LoadEventListener$LoadType) line: 195
DefaultLoadEventListener.onLoad(LoadEvent, LoadEventListener$LoadType) line: 103
SessionImpl.fireLoad(LoadEvent, LoadEventListener$LoadType) line: 878
SessionImpl.internalLoad(String, Serializable, boolean, boolean) line: 846
ManyToOneType(EntityType).resolveIdentifier(Serializable, SessionImplementor) line: 557
ManyToOneType.assemble(Serializable, SessionImplementor, Object) line: 196
PersistentBag.initializeFromCache(CollectionPersister, Serializable, Object) line: xxx //NOW HERE IS THE Bag initializing from cache, it fails, see top of the stack!!
CollectionCacheEntry.assemble(PersistentCollection, CollectionPersister, Object) line: 35
DefaultInitializeCollectionEventListener.initializeCollectionFromCache(Serializable, CollectionPersister, PersistentCollection, SessionImplementor) line: 130
DefaultInitializeCollectionEventListener.onInitializeCollection(InitializeCollectionEvent) line: 48
SessionImpl.initializeCollection(PersistentCollection, boolean) line: 1716
PersistentBag(AbstractPersistentCollection).forceInitialization() line: 454
StatefulPersistenceContext.initializeNonLazyCollections() line: 794
QueryLoader(Loader).doQueryAndInitializeNonLazyCollections(SessionImplementor, QueryParameters, boolean) line: 241
QueryLoader(Loader).doList(SessionImplementor, QueryParameters) line: 2220
QueryLoader(Loader).listIgnoreQueryCache(SessionImplementor, QueryParameters) line: 2104
QueryLoader(Loader).list(SessionImplementor, QueryParameters, Set, Type[]) line: 2099
QueryLoader.list(SessionImplementor, QueryParameters) line: 378
QueryTranslatorImpl.list(SessionImplementor, QueryParameters) line: 338
HQLQueryPlan.performList(QueryParameters, SessionImplementor) line: 172
SessionImpl.list(String, QueryParameters) line: 1121
QueryImpl.list() line: 79
QueryImpl.getResultList() line: 66
//some stack before, uninportant
Small fix to the PersistantBag has resolved this issue, however I cannot tell if it is correct by some hibernate principles:
public void initializeFromCache(CollectionPersister persister, Serializable disassembled, Object owner)
throws HibernateException {
Serializable[] array = (Serializable[]) disassembled;
int size = array.length;
List<Object> elements = new ArrayList<Object>(size);
for ( int i = 0; i < size; i++ ) {
Object element = persister.getElementType().assemble( array[i], getSession(), owner );
if ( element!=null ) {
elements.add( element );
}
}
beforeInitialize( persister, size );
for ( Object element : elements ) {
this.bag.add( element );
}
}
Difference is, before the this.bag.add(element) was called in first cycle, where the line of getting the element could cause reinitializing the collection and filling it up. There are various possibilities how to fix the problem, but I don't know if the fix is at the right place!
--
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, 7 months
[Hibernate-JIRA] Created: (HHH-3046) Merge fails on complicated data structure because of cycle references
by Pavol Zibrita (JIRA)
Merge fails on complicated data structure because of cycle references
---------------------------------------------------------------------
Key: HHH-3046
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3046
Project: Hibernate3
Issue Type: Bug
Affects Versions: 3.2.4
Environment: Hibernate-3.2.4.ga, db-platform any (h2 & oracle tested)
Reporter: Pavol Zibrita
On complicated object structure, hibernate was unable to merge it correctly because of attaching ID's to the new objects in the tree of the persistent entity. Hibernate cannot cope with cyclic references in this case and it fails with:
javax.persistence.PersistenceException: org.hibernate.PropertyValueException: not-null property references a null or transient value: org.hibernate.bugtests.data.Transport.pickupNode
at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:630)
at org.hibernate.ejb.AbstractEntityManagerImpl.merge(AbstractEntityManagerImpl.java:237)
at org.hibernate.bugtests.merge.MergeBug.mergeData(MergeBug.java:131)
at org.hibernate.bugtests.merge.MergeBug.testBug(MergeBug.java:149)
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:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
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:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
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)
Caused by: org.hibernate.PropertyValueException: not-null property references a null or transient value: org.hibernate.bugtests.data.Transport.pickupNode
at org.hibernate.engine.Nullability.checkNullability(Nullability.java:72)
at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:290)
at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:181)
at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:121)
at org.hibernate.ejb.event.EJB3MergeEventListener.saveWithGeneratedId(EJB3MergeEventListener.java:43)
at org.hibernate.event.def.DefaultMergeEventListener.entityIsTransient(DefaultMergeEventListener.java:186)
at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:123)
at org.hibernate.impl.SessionImpl.fireMerge(SessionImpl.java:687)
at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:669)
at org.hibernate.engine.CascadingAction$6.cascade(CascadingAction.java:245)
at org.hibernate.engine.Cascade.cascadeToOne(Cascade.java:268)
at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:216)
at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:169)
at org.hibernate.engine.Cascade.cascadeCollectionElements(Cascade.java:296)
at org.hibernate.engine.Cascade.cascadeCollection(Cascade.java:242)
at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:219)
at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:169)
at org.hibernate.engine.Cascade.cascade(Cascade.java:130)
at org.hibernate.event.def.AbstractSaveEventListener.cascadeAfterSave(AbstractSaveEventListener.java:456)
at org.hibernate.event.def.DefaultMergeEventListener.entityIsTransient(DefaultMergeEventListener.java:194)
at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:123)
at org.hibernate.impl.SessionImpl.fireMerge(SessionImpl.java:687)
at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:669)
at org.hibernate.engine.CascadingAction$6.cascade(CascadingAction.java:245)
at org.hibernate.engine.Cascade.cascadeToOne(Cascade.java:268)
at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:216)
at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:169)
at org.hibernate.engine.Cascade.cascadeCollectionElements(Cascade.java:296)
at org.hibernate.engine.Cascade.cascadeCollection(Cascade.java:242)
at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:219)
at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:169)
at org.hibernate.engine.Cascade.cascade(Cascade.java:130)
at org.hibernate.event.def.AbstractSaveEventListener.cascadeAfterSave(AbstractSaveEventListener.java:456)
at org.hibernate.event.def.DefaultMergeEventListener.entityIsTransient(DefaultMergeEventListener.java:194)
at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:123)
at org.hibernate.impl.SessionImpl.fireMerge(SessionImpl.java:687)
at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:669)
at org.hibernate.engine.CascadingAction$6.cascade(CascadingAction.java:245)
at org.hibernate.engine.Cascade.cascadeToOne(Cascade.java:268)
at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:216)
at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:169)
at org.hibernate.engine.Cascade.cascade(Cascade.java:130)
at org.hibernate.event.def.AbstractSaveEventListener.cascadeBeforeSave(AbstractSaveEventListener.java:431)
at org.hibernate.event.def.DefaultMergeEventListener.entityIsTransient(DefaultMergeEventListener.java:178)
at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:123)
at org.hibernate.impl.SessionImpl.fireMerge(SessionImpl.java:687)
at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:669)
at org.hibernate.engine.CascadingAction$6.cascade(CascadingAction.java:245)
at org.hibernate.engine.Cascade.cascadeToOne(Cascade.java:268)
at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:216)
at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:169)
at org.hibernate.engine.Cascade.cascadeCollectionElements(Cascade.java:296)
at org.hibernate.engine.Cascade.cascadeCollection(Cascade.java:242)
at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:219)
at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:169)
at org.hibernate.engine.Cascade.cascade(Cascade.java:130)
at org.hibernate.event.def.DefaultMergeEventListener.cascadeOnMerge(DefaultMergeEventListener.java:407)
at org.hibernate.event.def.DefaultMergeEventListener.entityIsPersistent(DefaultMergeEventListener.java:152)
at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:126)
at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:53)
at org.hibernate.impl.SessionImpl.fireMerge(SessionImpl.java:677)
at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:661)
at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:665)
at org.hibernate.ejb.AbstractEntityManagerImpl.merge(AbstractEntityManagerImpl.java:228)
... 20 more
However the value is set correctly.
--
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, 7 months
[Hibernate-JIRA] Created: (HHH-3810) Transient entities can be inserted twice on merge
by Gail Badner (JIRA)
Transient entities can be inserted twice on merge
-------------------------------------------------
Key: HHH-3810
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3810
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.3.1, 3.3.0.GA, 3.2.6
Reporter: Gail Badner
Assignee: Gail Badner
Fix For: 3.2.x, 3.3.x, 3.5
A transient entity being merged can be inserted twice if there is a cascade back to that same entity before it has been saved.
This bug was introduced by the fix for HHH-3229.
This can be illustrated by the following mapping (adapted from the test case at HHH-3046):
Route -- (1 : N) -- Node -- (N : 1) -- Tour
There are 3 objects:
route (persistent)
pickupNode (transient)
tour (transient)
Collections are sets.
node.route has cascade="none".
All other associations are cascade="merge,refresh"
route.nodes { pickupNode }
tour.nodes = { pickupNode }
pickupNode.route = route
pickupNode.tour = tour
The following shows the execution path that results in pickupNode being saved twice.
MERGE EVENT route (persistent)
MERGE EVENT pickupNode (transient)
|
| A) CASCADE_BEFORE_SAVE pickupNode
|
| MERGE EVENT tour (transient)
| |
| | A) CASCADE_BEFORE_SAVE tour (nothing to do)
| |
| | B) SAVE tour
| |
| | C) CASCADE_AFTER_SAVE tour
| |
| | MERGE EVENT pickupNode (still transient)
| | | (BUG: embedded merge event for same transient entity!!!)
| | |
| | | A) CASCADE_BEFORE_SAVE pickupNode
| | |
| | | MERGE EVENT tour (skip because it is already merged)
| | |
| | | B) SAVE pickupNode
| | | (BUG: saved in embedded merge event!!!)
| | |
| | | C) CASCADE_AFTER_SAVE pickupNode
| | |
|
| B) SAVE pickupNode
| (BUG: saved again in original merge event!!!)
|
| C) CASCADE_AFTER_SAVE pickupNode (nothing to do)
Prior to applying the fix for HHH-3229, the execution path was:
MERGE EVENT route (persistent)
MERGE EVENT pickupNode (transient)
|
| A) CASCADE_BEFORE_SAVE pickupNode
|
| MERGE EVENT tour (transient)
| |
| | A) CASCADE_BEFORE_SAVE tour (nothing to do)
| |
| | B) SAVE tour
| |
| | C) CASCADE_AFTER_SAVE tour
| |
| | MERGE EVENT pickupNode (still transient; skip because it is already being merged)
|
| B) SAVE pickupNode
|
| C) CASCADE_AFTER_SAVE pickupNode (nothing to do)
--
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, 7 months
[Hibernate-JIRA] Commented: (HHH-1480) JOIN precendence rules per SQL-99
by B. Gehrels (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1480?page=c... ]
B. Gehrels commented on HHH-1480:
---------------------------------
> I am only aware of this occurring from HQL queries.
It also happens when using JPQL-Queries via the EntityManager.
> JOIN precendence rules per SQL-99
> ---------------------------------
>
> Key: HHH-1480
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1480
> Project: Hibernate Core
> Issue Type: New Feature
> Components: query-hql
> Affects Versions: 3.1.2
> Reporter: trebor iksrazal
> Assignee: Steve Ebersole
> Fix For: 3.2.x, 3.3.x, 3.5
>
>
> In SQL-92 joins performed in the where clause (comma operator in from clause) and joins performed in the from clause (join keyword) had the same precedence. SQL-99 clarified this such that the from clause joins had higher precedence.
> Hibernate currently treats these as having the same precedence.
> A good explanation comes from the MySQL docs ( http://dev.mysql.com/doc/refman/5.0/en/join.html ) :
> #
> Previously, the comma operator (,) and JOIN both had the same precedence, so the join expression t1, t2 JOIN t3 was interpreted as ((t1, t2) JOIN t3). Now JOIN has higher precedence, so the expression is interpreted as (t1, (t2 JOIN t3)). This change affects statements that use an ON clause, because that clause can refer only to columns in the operands of the join, and the change in precedence changes interpretation of what those operands are.
> Example:
> CREATE TABLE t1 (i1 INT, j1 INT);
> CREATE TABLE t2 (i2 INT, j2 INT);
> CREATE TABLE t3 (i3 INT, j3 INT);
> INSERT INTO t1 VALUES(1,1);
> INSERT INTO t2 VALUES(1,1);
> INSERT INTO t3 VALUES(1,1);
> SELECT * FROM t1, t2 JOIN t3 ON (t1.i1 = t3.i3);
> Previously, the SELECT was legal due to the implicit grouping of t1,t2 as (t1,t2). Now the JOIN takes precedence, so the operands for the ON clause are t2 and t3. Because t1.i1 is not a column in either of the operands, the result is an Unknown column 't1.i1' in 'on clause' error. To allow the join to be processed, group the first two tables explicitly with parentheses so that the operands for the ON clause are (t1,t2) and t3:
> SELECT * FROM (t1, t2) JOIN t3 ON (t1.i1 = t3.i3);
> Alternatively, avoid the use of the comma operator and use JOIN instead:
> SELECT * FROM t1 JOIN t2 JOIN t3 ON (t1.i1 = t3.i3);
> This change also applies to statements that mix the comma operator with INNER JOIN, CROSS JOIN, LEFT JOIN, and RIGHT JOIN, all of which now have higher precedence than the comma operator.
--
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, 7 months
[Hibernate-JIRA] Created: (EJB-419) EntityManager.persist validation: Inconsistent with other JPA Implemetations
by Francisco Peredo (JIRA)
EntityManager.persist validation: Inconsistent with other JPA Implemetations
------------------------------------------------------------------------------
Key: EJB-419
URL: http://opensource.atlassian.com/projects/hibernate/browse/EJB-419
Project: Hibernate Entity Manager
Issue Type: Bug
Affects Versions: 3.3.2.GA
Reporter: Francisco Peredo
With the following JPA @Entity:
@Entity
public class Customer {
private Long id;
private String name;
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
@Column(nullable=false)
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
And then the following test
@Test
public void persistCustomerInTransaction() throws Exception {
factory = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME);
EntityManager em = factory.createEntityManager();
em.getTransaction().begin();
Customer customer = new Customer();
em.persist(customer);em.getTransaction().commit();
em.close();
}
Where does/should it crash?:
1. At the line em.persist(customer); because the name is configured as nullable=false, and we are trying to persist the Customer instance with a null value in the name property
2. em.getTransaction().commit(); because the name is configured as nullable=false, and we are trying to commit the transaction with a null value in the name property
Turns out... that the answer depends on the JPA provider you are using! If using Hibernate, it crashes at em.persist, but if using EclipseLink, it crashes at em.getTransaction().commit.
I think Hibernate it should validate this kind of things at em.getTransaction().commit() and not at em.persist.
--
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, 7 months
[Hibernate-JIRA] Closed: (HHH-1930) QuerySyntaxException "with-clause expressions did not reference from-clause element to which the with-clause was associated"
by Steve Ebersole (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1930?page=c... ]
Steve Ebersole closed HHH-1930.
-------------------------------
Resolution: Fixed
Applied your patch Oleg. Thanks!
> QuerySyntaxException "with-clause expressions did not reference from-clause element to which the with-clause was associated"
> ----------------------------------------------------------------------------------------------------------------------------
>
> Key: HHH-1930
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1930
> Project: Hibernate Core
> Issue Type: Bug
> Components: query-hql
> Affects Versions: 3.1.3, 3.2.0 cr1, 3.2.0.cr2, 3.2.0.cr3
> Reporter: Manfred Geiler
> Assignee: Steve Ebersole
> Priority: Minor
> Fix For: 3.2.x, 3.3.x, 3.5
>
> Attachments: HibernateTestCase.zip, hqlsqlwalker.diff
>
>
> In Version 3.1.2 the following "EventManager" HQL query worked fine:
> select p from Person p join p.emailAddresses as email with email = 'xyz'
> and produced an SQL query like this:
> select person0_.PERSON_ID as PERSON1_2_, person0_.age as age2_, person0_.firstname as firstname2_, person0_.lastname as lastname2_
> from PERSON person0_
> inner join PERSON_EMAIL_ADDR emailaddre1_
> on person0_.PERSON_ID=emailaddre1_.PERSON_ID and (emailaddre1_.EMAIL_ADDR='xyz')
> From Version 3.1.3 on this HQL throws the following QuerySyntaxException:
> "with-clause expressions did not reference from-clause element to which the with-clause was associated"
--
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, 7 months
[Hibernate-JIRA] Commented: (ANN-23) Support for initialValue of @SequenceGenerator
by Peter Kamm (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/ANN-23?page=com... ]
Peter Kamm commented on ANN-23:
-------------------------------
Why does this not work (Standard JPA Annotation):
@SequenceGenerator(name = "GEN_SEQ_GEN", sequenceName = "XY_SEQ",
allocationSize = 100, initialValue = 1000000)
If this works (Hibernate dependent)
@GenericGenerator( name = "GEN_SEQ_GEN",
strategy = "org.hibernate.id.enhanced.SequenceStyleGenerator",
parameters = {
@Parameter(name = "sequence_name", value = "XY_SEQ"),
@Parameter(name = "initial_value", value = 1000000),
@Parameter(name = "increment_size", value = 100)
}
)
Could the enhanced SequenceStyleGenerator not be used for standard JPA so that the allocationSize works correct (also for
DDL Generation)?
> Support for initialValue of @SequenceGenerator
> ----------------------------------------------
>
> Key: ANN-23
> URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-23
> Project: Hibernate Annotations
> Issue Type: Bug
> Components: binder
> Affects Versions: 3.1beta3
> Reporter: Emmanuel Bernard
> Priority: Minor
>
> AllocationSize resolved in ANN-296
--
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, 7 months