[Hibernate-JIRA] Closed: (HHH-909) Onquoted primary key in IncrementGenerator
by Steve Ebersole (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-909?page=co... ]
Steve Ebersole closed HHH-909.
------------------------------
Closing stale resolved issues
> Onquoted primary key in IncrementGenerator
> ------------------------------------------
>
> Key: HHH-909
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-909
> Project: Hibernate Core
> Issue Type: Improvement
> Components: core
> Affects Versions: 3.0.5
> Reporter: Andrey Grebnev
> Priority: Minor
> Fix For: 3.1 rc 1
>
> Original Estimate: 10m
> Remaining Estimate: 10m
>
> I have examined the source code of Hibernate 3.0.5 and I found following problem.
> In org.hibernate.id.IncrementGenerator we can see the following code
> if (column==null) column = params.getProperty(PersistentIdentifierGenerator.PK);
> ...
> sql = "select max(" + column + ") from " + buf.toString();
> and in
> org.hibernate.mapping.SimpleValue
> params.setProperty( PersistentIdentifierGenerator.PK, ( (Column) getColumnIterator().next() ).getName() );
> getName() of org.hibernate.mapping.Column returns unquoted string.
> It is very bad because different DBMSes interpret unquoted field names in different manner. E.g. PostgreSQL converts all field names into lowercase and HSQLDB converts all field names into uppercase.
> As result the application built on Hibernate with IncrementGenerator is not portable.
> I offer to change
> params.setProperty( PersistentIdentifierGenerator.PK, ( (Column) getColumnIterator().next() ).getName() );
> to
> params.setProperty( PersistentIdentifierGenerator.PK, ( (Column) getColumnIterator().next() ).getQuotedName(dialect) );
> Andrey Grebnev
--
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, 1 month
[Hibernate-JIRA] Closed: (HHH-1036) java.lang.NullPointerException when the result array has more than one record.
by Steve Ebersole (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1036?page=c... ]
Steve Ebersole closed HHH-1036.
-------------------------------
Closing stale resolved issues
> java.lang.NullPointerException when the result array has more than one record.
> ------------------------------------------------------------------------------
>
> Key: HHH-1036
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1036
> Project: Hibernate Core
> Issue Type: Bug
> Components: core
> Affects Versions: 3.1 rc 1
> Environment: hibernate 3.1rc1, Sybase
> Reporter: hamid
> Original Estimate: 4h
> Remaining Estimate: 4h
>
> The query below works fine when the there is only one record with the firstName in the database but gives null pointer exception when there are more than one row with the given firstName.
> the query=from com.lowes.gr.dataObjects.RegistryHib as registry where lower(registry.registryAdditionalRegistrantHib.coRegistrantsHib.firstName) like ?
> the query.getQueryString=from com.lowes.gr.dataObjects.RegistryHib as registry where lower(registry.registryAdditionalRegistrantHib.coRegistrantsHib.firstName) like ?
> the query.getNamedParameters=[]
> Hibernate: select registryhi0_.T3381_RGY_NBR as T1_, registryhi0_.T3391_RGY_EVN_CD as T2_0_, registryhi0_.RGY_EVN_NME as RGY3_0_, registryhi0_.RGY_EVN_DM as RGY4_0_, registryhi0_.RGY_ORG_LCT_NBR as RGY5_0_, registryhi0_.T3392_DCO_STY_CD as T6_0_, registryhi0_.RGY_PAL_CMT_1_TXT as RGY7_0_, registryhi0_.RGY_PAL_CMT_2_TXT as RGY8_0_, registryhi0_.RGY_PAL_CMT_3_TXT as RGY9_0_, registryhi0_.SHP_PRL_NME as SHP10_0_, registryhi0_.T3387_RGY_SRC_CD as T11_0_, registryhi0_.RGY_PVT_IDC as RGY12_0_, registryhi0_.RGY_DCR_NFN_IDC as RGY13_0_, registryhi0_.RGY_LOW_NFN_IDC as RGY14_0_, registryhi0_.T3386_RGY_STS_CD as T15_0_, registryhi0_.RGY_PRL_ARC_DM as RGY16_0_, registryhi0_.ADD_DM as ADD17_0_, registryhi0_.UPD_DM as UPD18_0_, registryhi0_.UPD_ID as UPD19_0_, registryhi0_.RGY_GST_PSW_TXT as RGY20_0_, registryhi0_.T3620_QST_PSW_CD as T21_0_, registryhi0_.RGY_ANS_PSW_TXT as RGY22_0_, registryhi0_.RGY_CTC_PRL_NME as RGY23_0_, registryhi0_.RGY_CRE_DM as RGY24_0_, registryhi0_.T3380_RGY_RGS_NBR as T25_0_ from T3381_RGY_PRL registryhi0_, T3383_RGY_ADD_RGS registryad1_, T3380_RGY_RGS_PRL registryre2_ where registryad1_.T3380_RGY_RGS_NBR=registryre2_.T3380_RGY_RGS_NBR and registryhi0_.T3381_RGY_NBR=registryad1_.T3381_RGY_NBR and (lower(registryre2_.RGS_FIR_NME)like ?)
> 13:47:01,771 ERROR ProcessDB:2359 - Hibernate Exception
> java.lang.NullPointerException
> java.lang.NullPointerException
> at org.hibernate.event.def.DefaultInitializeCollectionEventListener.initializeCollectionFromCache(DefaultInitializeCollectionEventListener.java:87)
> at org.hibernate.event.def.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:48)
> at org.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:1430)
> at org.hibernate.collection.AbstractPersistentCollection.forceInitialization(AbstractPersistentCollection.java:280)
> at org.hibernate.engine.PersistenceContext.initializeNonLazyCollections(PersistenceContext.java:796)
> at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:223)
> at org.hibernate.loader.Loader.doList(Loader.java:1593)
> at org.hibernate.loader.Loader.list(Loader.java:1577)
> at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:395)
> at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:271)
> at org.hibernate.impl.SessionImpl.list(SessionImpl.java:844)
> at org.hibernate.impl.QueryImpl.list(QueryImpl.java:74)
> at com.lowes.gr.database.impl.ProcessDBImpl.getFindCoRegistrant(ProcessDBImpl.java:2280)
> at com.lowes.gr.webServices.ProcessWS.findRegistrant(ProcessWS.java:1263)
> 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:324)
> at org.apache.axis.providers.java.RPCProvider.invokeMethod(RPCProvider.java:388)
> at org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:283)
> at org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:323)
> at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
> at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
> at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
> at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:453)
> at org.apache.axis.server.AxisServer.invoke(AxisServer.java:281)
> at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:699)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:767)
> at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
> at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
> at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
> at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
> at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
> at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
> at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
> at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
> at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:825)
> at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:738)
> at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:526)
> at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
> at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
> at java.lang.Thread.run(Thread.java:534)
> Hibernate Exceptionnull
> 13:47:01,771 ERROR ProcessWS:1268 - Database error reading dbRegistrantList from DB.
> com.lowes.gr.services.HibernateUtilException
> at com.lowes.gr.database.impl.ProcessDBImpl.getFindCoRegistrant(ProcessDBImpl.java:2361)
> at com.lowes.gr.webServices.ProcessWS.findRegistrant(ProcessWS.java:1263)
> 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:324)
> at org.apache.axis.providers.java.RPCProvider.invokeMethod(RPCProvider.java:388)
> at org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:283)
> at org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:323)
> at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
> at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
> at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
> at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:453)
> at org.apache.axis.server.AxisServer.invoke(AxisServer.java:281)
> at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:699)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:767)
> at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
> at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
> at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
> at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
> at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
> at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
> at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
> at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
> at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:825)
> at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:738)
> at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:526)
> at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
> at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
> at java.lang.Thread.run(Thread.java:534)
> inside exception=com.lowes.gr.services.HibernateUtilException
--
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, 1 month
[Hibernate-JIRA] Closed: (HHH-897) Cascades with assigned identifier in children not saving in 3.0.5
by Steve Ebersole (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-897?page=co... ]
Steve Ebersole closed HHH-897.
------------------------------
Closing stale resolved issues
> Cascades with assigned identifier in children not saving in 3.0.5
> -----------------------------------------------------------------
>
> Key: HHH-897
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-897
> Project: Hibernate Core
> Issue Type: Bug
> Components: core
> Affects Versions: 3.0.5
> Environment: Hibernate 3.0.5, Oracle 9i, Spring 1.2.2
> Reporter: Rick Birch
>
> In section 22.4 of the Hibernate manual, the manual describes the correct action that should be taken when a cascaded subclass is being saved/updated:
> Well, that's all very well for the case of a generated identifier, but what about assigned identifiers and composite
> identifiers? This is more difficult, since Hibernate can't use the identifier property to distinguish between a
> newly instantiated object (with an identifier assigned by the user) and an object loaded in a previous session. In
> this case, Hibernate will either use the timestamp or version property, or will actually query the second-level
> cache or, worst case, the database, to see if the row exists.
> However, the code that does that in the BasicEntityPersister class public Boolean isTransient(Object entity, SessionImplementor session) method can never get to the second-level cache check.
> ....
> // check the id unsaved-value
> Boolean result = entityMetamodel.getIdentifierProperty()
> .getUnsavedValue().isUnsaved( id );
> if ( result != null ) return result;
> // check to see if it is in the second-level cache
> if ( hasCache() ) {
> CacheKey ck = new CacheKey( id, getIdentifierType(), getRootEntityName(), session.getEntityMode(), session.getFactory() );
> if ( getCache().get( ck, session.getTimestamp() ) != null ) return Boolean.FALSE;
> }
> If result from the entityMetamodel.getIdentifierProperty() .getUnsavedValue().isUnsaved( id ); is not null, then this if statement will return a result. The Cascades.isUnsaved(id) method always returns a Boolean value, so the if (hasCache()) check can never be reached.
> public Boolean isUnsaved(Serializable id) {
> return id==null || id.equals(value) ? Boolean.TRUE : Boolean.FALSE;
> }
> For us, we'll be changing to generated keys. But the assigned strategy works better with Unit Test code, allows for more predictable results. Apologies in advanced if this is already fix in 3.1, but I didn't see any reference that I could interpret in the release notes for 3.1 beta.
--
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, 1 month