[Hibernate-JIRA] Created: (HHH-2974) Native SQLQuey combined with addEntity forces to retrieve all columns
by Philippe Mouawad (JIRA)
Native SQLQuey combined with addEntity forces to retrieve all columns
---------------------------------------------------------------------
Key: HHH-2974
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2974
Project: Hibernate3
Issue Type: Bug
Components: core, documentation
Affects Versions: 3.2.5, 3.2.4.sp1, 3.2.4, 3.2.3, 3.2.2, 3.2.1, 3.2.0.ga, 3.2.0.cr5, 3.2.0.cr4, 3.2.0.cr3, 3.2.0.cr2, 3.2.0 cr1, 3.1.3, 3.2.0.alpha2, 3.2.0.alpha1, 3.1.2, 3.1.1, 3.1, 3.1 rc3, 3.1 rc2, 3.1 rc 1, 3.1 beta 2, 3.1 beta 1, 3.0.5, 3.0.4, 3.0.3, 3.0.2, 3.0.1, 3.0 final, 3.0 rc 1, 3.0 beta 4, 3.0 beta 3, 3.0 beta 2, 3.0 beta 1, 3.0 alpha
Environment: Hibernate 3.2.5, All Databases
Reporter: Philippe Mouawad
Attachments: ArtLibelle.hbm.xml
Hello,
I think it is rather a feature after looking inside Hibernate Code but since I didn't find anything about it in the Docs Chapter 16 (http://www.hibernate.org/hib_docs/reference/en/html/querysql.html)
The problem is that If you do not specify <alias>.* in a Native SQL Query it will fail.
To be clear, it seems that when using addEntity or <return alias="..." /> you cannot retrieve only the column you are interested in. Instead addScalar or <return-scalar must be used.
I think the documentation shoud explicitely indicate it or the feature shoud be developped since it would be rather a great feature when native SQL has to be used.
Hibernate Mapping:
Attached file
<sql-query name="getInfoComplEcom">
<return alias="acv" class="com.kingfisher.chrgtecom.dataobject.ecom.DoArtCondVente" />
<![CDATA[
SELECT
theAcv.CARTICLE as {acv.carticle},
theAcv.CESCLAVE as {acv.cesclave},
theAcv.LARTICLE as {acv.larticle},
theAcv.LARTICLE_RED as {acv.larticleRed}
FROM ART_COND_VENTE theAcv
WHERE theAcv.CARTICLE in (:codeArticles)
]]>
</sql-query>
Java code:
// codeArticles is a List of Integer Ids
Session session = getCurrentSession();
Query query = session.getNamedQuery("getInfoComplEcom");
query.setParameterList("codeArticles",codeArticles);
List result = query.list();
return result;
Missing column is :TMODIF6_0_ , alias column of tmodif property, not in Native Query
Stack:
ERROR:http-8080-Processor4-org.hibernate.util.JDBCExceptionReporter-Nom de colonne non valide
ERROR:http-8080-Processor4-com.foo.action.ChargerProduitAction-Development error for URI :'/chrgtecom/main/chargerProduit.do'
org.hibernate.exception.GenericJDBCException: could not execute query
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
at org.hibernate.exception.JDBCExceptionHelper.convert (JDBCExceptionHelper.java:43)
at org.hibernate.loader.Loader.doList(Loader.java:2223)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
at org.hibernate.loader.Loader.list(Loader.java :2099)
at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:289)
at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1695)
at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java :142)
at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:152)
at com.foo.dao.EcomDao.getInfoComplEcom(EcomDao.java:112)
at com.foo.services.EcomServices.getInfoComplEcom (EcomServices.java:20)
at com.foo.services.EcomServices$$FastClassByCGLIB$$5dc5078d.invoke(<generated>)
at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint (Cglib2AopProxy.java:695)
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.transaction.interceptor.TransactionInterceptor.invoke (TransactionInterceptor.java:107)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:166)
at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept (Cglib2AopProxy.java:630)
at com.foo.services.EcomServices$$EnhancerByCGLIB$$4ffbebb6.getInfoComplEcom(<generated>)
at com.foo.services.AgileServices.getInfosCompl(AgileServices.java :131)
at com.foo.services.AgileServices.prepareInfosCompl(AgileServices.java:152)
at com.foo.services.AgileServices$$FastClassByCGLIB$$b720e887.invoke(<generated>)
at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:695)
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.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:630)
at com.foo.services.AgileServices$$EnhancerByCGLIB$$61330582.prepareInfosCompl (<generated>)
at com.foo.action.ChargerProduitAction.process(ChargerProduitAction.java:122)
at com.ubikingenierie.fwk.action.GenericAction.execute(GenericAction.java:113)
at org.springframework.web.struts.DelegatingActionProxy.execute (DelegatingActionProxy.java:110)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
at com.ubikingenierie.fwk.struts.processor.FwkRequestProcessor.process(FwkRequestProcessor.java:142)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
at org.apache.struts.action.ActionServlet.doPost (ActionServlet.java:432)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain.java:199)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:145)
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java :63)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:75)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:165)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:145)
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:265)
at org.acegisecurity.intercept.web.FilterSecurityInterceptor.invoke (FilterSecurityInterceptor.java:107)
at org.acegisecurity.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:72)
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter (FilterChainProxy.java:275)
at org.acegisecurity.ui.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:110)
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java :275)
at com.ubikingenierie.fwk.timeout.LoggedOnApplicationFilter.doFilter(LoggedOnApplicationFilter.java:101)
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
at org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125)
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:229)
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
at org.acegisecurity.ui.logout.LogoutFilter.doFilter (LogoutFilter.java:106)
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java :286)
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
at org.acegisecurity.securechannel.ChannelProcessingFilter.doFilter(ChannelProcessingFilter.java:138)
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
at org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:149)
at org.acegisecurity.util.FilterToBeanProxy.doFilter (FilterToBeanProxy.java:98)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:165)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java :145)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:955)
at org.apache.catalina.core.StandardContextValve.invoke (StandardContextValve.java:139)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java :198)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:955)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2460)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java :133)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:119)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext (StandardPipeline.java:594)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:545)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java :594)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:955)
at org.apache.catalina.core.StandardEngineValve.invoke (StandardEngineValve.java:127)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java :433)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:955)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:157)
at org.apache.coyote.http11.Http11Processor.process (Http11Processor.java:874)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java :528)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)
at java.lang.Thread.run (Thread.java:534)
Caused by: java.sql.SQLException: Nom de colonne non valide
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125)
at oracle.jdbc.driver.DatabaseError.throwSqlException (DatabaseError.java:162)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:227)
at oracle.jdbc.driver.OracleStatement.get_column_index(OracleStatement.java:3060)
at oracle.jdbc.driver.OracleResultSetImpl.findColumn (OracleResultSetImpl.java:1861)
at org.apache.commons.dbcp.DelegatingResultSet.findColumn(DelegatingResultSet.java:292)
at org.hibernate.jdbc.ColumnNameCache.getIndexForColumnName(ColumnNameCache.java:28)
at org.hibernate.jdbc.ResultSetWrapper.findColumn(ResultSetWrapper.java:61)
at org.hibernate.jdbc.ResultSetWrapper.getString(ResultSetWrapper.java:225)
at org.hibernate.type.StringType.get(StringType.java :18)
at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:163)
at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:154)
at org.hibernate.type.AbstractType.hydrate(AbstractType.java :81)
at org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:2096)
at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1380)
at org.hibernate.loader.Loader.instanceNotYetLoaded (Loader.java:1308)
at org.hibernate.loader.Loader.getRow(Loader.java:1206)
at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:580)
at org.hibernate.loader.Loader.doQuery(Loader.java:701)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
at org.hibernate.loader.Loader.doList(Loader.java:2220)
... 98 more
Hope this is not a duplicate, I searched for a bug or in the forum.
Philippe
http://www.ubik-ingenierie.com
--
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
18 years, 4 months
[Hibernate-JIRA] Created: (HHH-2977) Problem with one-to-many assotiations in Hibernate with enable JBoss Cache !
by Eugene Batogov (JIRA)
Problem with one-to-many assotiations in Hibernate with enable JBoss Cache !
----------------------------------------------------------------------------
Key: HHH-2977
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2977
Project: Hibernate3
Issue Type: Bug
Affects Versions: 3.2.5
Environment: Hibernate: 3.2.5
DBMS: PortgreSQL 3.2.4
JBoss Cache 1.4.1SP6
Reporter: Eugene Batogov
Priority: Critical
Attachments: cacheProblem.log, Movie.java, MovieCategory.java
Hello !
I have next problem ...
I have entity MovieCategory and entity Movie.
MovieCategory relate with Movie in many to one.
I have two MovieCategories.
But if I remove Movie from first MovieCategory and add to second MovieCategory,
then movie have added to second MovieCategory successful.
But from first MovieCategory this Movie don't remove !!!
This appear only if JBoss Cache is enabled.
If second level cache is disabled, then all work properly !
I am insert part of log, where show how Hibernate work with cache .
Please, help me! This problem is critical for me !
--
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
18 years, 4 months
[Hibernate-JIRA] Commented: (ANN-376) @SecondaryTable together with @Inheritance(strategy=InheritanceType.JOINED) fails
by bugmenot (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/ANN-376?page=co... ]
bugmenot commented on ANN-376:
------------------------------
What this is it duplicate ? Exists some workaround? Thanks
> @SecondaryTable together with @Inheritance(strategy=InheritanceType.JOINED) fails
> ---------------------------------------------------------------------------------
>
> Key: ANN-376
> URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-376
> Project: Hibernate Annotations
> Issue Type: Bug
> Affects Versions: 3.2.0.cr1
> Environment: Hibernate 3.2.0.cr2 included in JBoss4.0.4GA, MySQL 5
> Reporter: André J. Rogger
>
> Persister of JoinedSubclassEntity fails together with secondary table annotation (the other inheritence strategies are working fine).
> For example with the following two classes A and B:
> [A.java]
> @Entity
> @SecondaryTable(name="C")
> @Inheritance(strategy=InheritanceType.JOINED)
> public class A {
> @Id
> long id;
>
> @Column(table="C")
> String fieldInC;
> }
> [B.java]
> @Entity
> public class B extends A {
> String fieldOfB;
> }
> the deployment produces the following error:
> org.hibernate.AssertionFailure: Table C not found
> at org.hibernate.persister.entity.JoinedSubclassEntityPersister.getTableId(JoinedSubclassEntityPersister.java:444)
> at org.hibernate.persister.entity.JoinedSubclassEntityPersister.<init>(JoinedSubclassEntityPersister.java:225)
> at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:58)
> ...
--
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
18 years, 4 months
[Hibernate-JIRA] Created: (EJB-307) Unable to create the table for a class extending a 2 tables mapped abstract class
by Brice LEPORINI (JIRA)
Unable to create the table for a class extending a 2 tables mapped abstract class
----------------------------------------------------------------------------------
Key: EJB-307
URL: http://opensource.atlassian.com/projects/hibernate/browse/EJB-307
Project: Hibernate Entity Manager
Issue Type: Bug
Components: EntityManager
Affects Versions: 3.2.1
Environment: JBoss 4.2.0 GA, WinXP SP2, Only using javax.persistence annotations
Reporter: Brice LEPORINI
persistence.xml:
<properties>
<property name="hibernate.hbm2ddl.auto" value="create-drop"/>
<property name="hibernate.show_sql" value="true" />
</properties>
One main abstract class mapped on 2 tables:
@Entity
@Table(name="T_CRI")
@SecondaryTable(name="T_CRI_FT",
pkJoinColumns=@PrimaryKeyJoinColumn(name="PK_IDCRI", referencedColumnName="PK_IDCRI"))
@Inheritance(strategy=InheritanceType.JOINED)
public abstract class CriFt implements Cri,Identified {
[.......]
}
Deployment with schema export works fine...
Now let's create a new class extending this one:
@Entity
@Table(name="T_CRI_FT_MAINTENANCE")
public class CriFtMaintenance extends CriFt implements Serializable, Identified, Cri {
[......]
}
Now deployment throws an exception:
09:41:23,359 INFO [SessionFactoryImpl] building session factory
09:41:23,437 ERROR [AssertionFailure] an assertion failure occured (this may indicate a bug in Hibernate, but is more likely due to unsafe use of the session)
org.hibernate.AssertionFailure: Table T_CRI_FT not found
If Inheritance strategy is anything else than JOINED, there is no problem.
Feel free to contact me in order to get more informations about environment.
--
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
18 years, 4 months
[Hibernate-JIRA] Closed: (HHH-952) Patch to allow subqueries with joins using Criteria API and Subqueries with DetachedCriteria
by Gail Badner (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-952?page=co... ]
Gail Badner closed HHH-952.
---------------------------
> Patch to allow subqueries with joins using Criteria API and Subqueries with DetachedCriteria
> --------------------------------------------------------------------------------------------
>
> Key: HHH-952
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-952
> Project: Hibernate3
> Issue Type: Patch
> Components: core
> Affects Versions: 3.1 beta 1, 3.1 beta 2
> Environment: 3.1beta1 with MS SQL 2000 via jTDS
> Reporter: John
> Assignee: Gail Badner
> Priority: Critical
> Fix For: 3.2.6, 3.3
>
> Attachments: subquery-patch-3.2.4.SP1.txt, subquery-patch-311.txt, subquery-patch-313.txt, subquery-patch-31beta3.txt, subquery-patch.txt, subquery-patch.txt, SubqueryExpression.java
>
>
> The existing code in SubqueryExpression.java constructed a select statement but did not have any provisions for creating joins. Therefore, it was not possible using the criteria API to create an exists subselect that had a join, even though running the source DetachedCriteria alone works perfectly.
> For example, if this is the goal:
> select * from foo f
> where exists (select id from bar b join other o on b.o_id = o.id where o.prop = '123' and b.foo_id = f.id)
> One might try something like this:
> Criteria crit = session.createCriteria(Foo.class, fooAlias);
> DetachedCriteria barCrit = DetachedCriteria.forClass(Bar.class, barAlias);
> DetachedCriteria otherCrit = barCrit.createCriteria(Bar.OTHER_JOIN);
> otherCrit.add( Restrictions.eq(Other.PROP, "123") );
> barCrit.add( Restrictions.eqProperty( -- props to join to foo here --) );
> barCrit.setProjection( Projections.id() );
> crit.add( Subqueries.exists(barCrit) );
> However, the existing code generates something like the following, which gets an error with an unknown alias 'o':
> select * from foo f
> where exists (select id from bar b where o.prop = '123' and b.foo_id = f.id)
> This is also described here (at the end): http://forum.hibernate.org/viewtopic.php?t=942488
> The patch to SubqueryExpression.java fixes this to included the joins necessary for the filtering. This code was modeled (copied) off of code from CriteriaLoader. For me this works perfectly, but I don't understand the internals of this stuff enough to say how robust it is. Also included is a patch to the test case to enable testing of this, which was present but commented out. I did not change the contents of the test, which currently only attempts a joined subquery. This used to fail with an error, but now it works. The test does not check the results at all. (Inconsequential to the patch - Enrollment has two Ls.)
> -----side notes
> The patch file also has two other patches. The first increases the delay in BulkManipulationTest because I was getting inconsistent test results. I think that the precision on the version timestamp is not enough for 300 milliseconds delay to be enough to guarantee the test results. Also, in build.xml, there was a line that was meant to exclude the performance tests, but there was no **/*, on *, so they actually were not excluded. I changed this so the tests would complete in a reasonable amount of time. However, there is one other issue with testing that I worked around manually. After each test run, two databases (Users and Email) were left in the database. If I did not manually delete these then the number of failures on the next test run was different. This was really confusing until I figured it out because I was trying to make sure all the other testcases still passed with my patch, but even without the patch I was getting different results.
--
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
18 years, 4 months
[Hibernate-JIRA] Resolved: (HHH-952) Patch to allow subqueries with joins using Criteria API and Subqueries with DetachedCriteria
by Gail Badner (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-952?page=co... ]
Gail Badner resolved HHH-952.
-----------------------------
Resolution: Fixed
Commited fiix to 3.2 branch and made formatting corrections (e.g., spaces to tabs) to trunk version.
> Patch to allow subqueries with joins using Criteria API and Subqueries with DetachedCriteria
> --------------------------------------------------------------------------------------------
>
> Key: HHH-952
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-952
> Project: Hibernate3
> Issue Type: Patch
> Components: core
> Affects Versions: 3.1 beta 1, 3.1 beta 2
> Environment: 3.1beta1 with MS SQL 2000 via jTDS
> Reporter: John
> Assignee: Gail Badner
> Priority: Critical
> Fix For: 3.2.6, 3.3
>
> Attachments: subquery-patch-3.2.4.SP1.txt, subquery-patch-311.txt, subquery-patch-313.txt, subquery-patch-31beta3.txt, subquery-patch.txt, subquery-patch.txt, SubqueryExpression.java
>
>
> The existing code in SubqueryExpression.java constructed a select statement but did not have any provisions for creating joins. Therefore, it was not possible using the criteria API to create an exists subselect that had a join, even though running the source DetachedCriteria alone works perfectly.
> For example, if this is the goal:
> select * from foo f
> where exists (select id from bar b join other o on b.o_id = o.id where o.prop = '123' and b.foo_id = f.id)
> One might try something like this:
> Criteria crit = session.createCriteria(Foo.class, fooAlias);
> DetachedCriteria barCrit = DetachedCriteria.forClass(Bar.class, barAlias);
> DetachedCriteria otherCrit = barCrit.createCriteria(Bar.OTHER_JOIN);
> otherCrit.add( Restrictions.eq(Other.PROP, "123") );
> barCrit.add( Restrictions.eqProperty( -- props to join to foo here --) );
> barCrit.setProjection( Projections.id() );
> crit.add( Subqueries.exists(barCrit) );
> However, the existing code generates something like the following, which gets an error with an unknown alias 'o':
> select * from foo f
> where exists (select id from bar b where o.prop = '123' and b.foo_id = f.id)
> This is also described here (at the end): http://forum.hibernate.org/viewtopic.php?t=942488
> The patch to SubqueryExpression.java fixes this to included the joins necessary for the filtering. This code was modeled (copied) off of code from CriteriaLoader. For me this works perfectly, but I don't understand the internals of this stuff enough to say how robust it is. Also included is a patch to the test case to enable testing of this, which was present but commented out. I did not change the contents of the test, which currently only attempts a joined subquery. This used to fail with an error, but now it works. The test does not check the results at all. (Inconsequential to the patch - Enrollment has two Ls.)
> -----side notes
> The patch file also has two other patches. The first increases the delay in BulkManipulationTest because I was getting inconsistent test results. I think that the precision on the version timestamp is not enough for 300 milliseconds delay to be enough to guarantee the test results. Also, in build.xml, there was a line that was meant to exclude the performance tests, but there was no **/*, on *, so they actually were not excluded. I changed this so the tests would complete in a reasonable amount of time. However, there is one other issue with testing that I worked around manually. After each test run, two databases (Users and Email) were left in the database. If I did not manually delete these then the number of failures on the next test run was different. This was really confusing until I figured it out because I was trying to make sure all the other testcases still passed with my patch, but even without the patch I was getting different results.
--
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
18 years, 4 months
[Hibernate-JIRA] Created: (HHH-2712) OneToOne mapping with PrimaryKeyJoinColumn and CascadeType.ALL throws IdentifierGenerationException
by Colin Smith (JIRA)
OneToOne mapping with PrimaryKeyJoinColumn and CascadeType.ALL throws IdentifierGenerationException
---------------------------------------------------------------------------------------------------
Key: HHH-2712
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2712
Project: Hibernate3
Issue Type: Bug
Environment: Hibernate 3.2.4, Annotations 3.3.0
Reporter: Colin Smith
Customer has a 1-1 mapping with CustomerRiskProfile.
@Id
@GeneratedValue(strategy = GenerationType.TABLE, generator = "SEQUENTIAL_HILO_GENERATOR")
private Long id;
@OneToOne(cascade = CascadeType.ALL)
@PrimaryKeyJoinColumn
private CustomerRiskProfile customerRiskProfile;
CustomerRiskProfile has:
@Id
private Long id;
@OneToOne(mappedBy = "customerRiskProfile")
private Customer customer;
If I create a new Customer and a new CustomerRiskProfile, associate the two, then call session.save(customer), I get:
org.springframework.orm.hibernate3.HibernateSystemException: ids for this class must be manually assigned before calling save(): com.cantorcfds.domain.CustomerRiskProfile; nested exception is org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before calling save(): com.cantorcfds.domain.CustomerRiskProfile
Caused by: org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before calling save(): com.cantorcfds.domain.CustomerRiskProfile
at org.hibernate.id.Assigned.generate(Assigned.java:33)
at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:99)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:187)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:172)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:94)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
at org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:507)
at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:499)
at org.hibernate.engine.CascadingAction$1.cascade(CascadingAction.java:218)
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.cascadeAfterSave(AbstractSaveEventListener.java:456)
at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:334)
at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:181)
at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:121)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:187)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:172)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:94)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
at org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:507)
at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:499)
at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:495)
at org.springframework.orm.hibernate3.HibernateTemplate$16.doInHibernate(HibernateTemplate.java:689)
at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:372)
at org.springframework.orm.hibernate3.HibernateTemplate.saveOrUpdate(HibernateTemplate.java:686)
at com.cantorcfds.dao.HibernateCustomerDao.save(HibernateCustomerDao.java:36)
at com.cantorcfds.domain.TestSchemaLoad.testDataLoad(TestSchemaLoad.java:33)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:40)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
I would expect Hibernate to generate the Id for the Customer AND the CustomerRiskProfile before trying to save anything?
--
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
18 years, 4 months