[Hibernate-JIRA] Commented: (HHH-1685) DetachedCriteria doesn't create alias on subcriteria
by Philip Saville (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1685?page=c... ]
Philip Saville commented on HHH-1685:
-------------------------------------
The work around doesn't work when trying to add criterion to the subcriteria which is now only an alias.
I am trying to convert my code to use DetachedCriteria instead of Criteria and what was working for one or two deep joins does not work when using DetachedCriteria.
Originally, when using "createCriteria" method - the error was:
org.springframework.orm.hibernate3.HibernateQueryException: could not resolve property: ALIAS_NAME_FOR_SUBCRITERIA of: SUBCRITERIA_OBJECT; nested exception is org.hibernate.QueryException: could not resolve property: ALIAS_NAME_FOR_SUBCRITERIA of: SUBCRITERIA_OBJECT
org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:651)
org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:408)
org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:367)
org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:328)
Now, when trying the work around "createAlias" method - the error is:
org.springframework.orm.hibernate3.HibernateQueryException: could not resolve property: FIELD_IN_SUBCRITERIA_TABLE of: CRITERIA_OBJECT; nested exception is org.hibernate.QueryException: could not resolve property: FIELD_IN_SUBCRITERIA_TABLE of: CRITERIA_OBJECT
org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:651)
org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:408)
org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:367)
org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:328)
When will this issue be fixed? Can't someone just make the above mentioned change and have it be part of the next build?
> DetachedCriteria doesn't create alias on subcriteria
> ----------------------------------------------------
>
> Key: HHH-1685
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1685
> Project: Hibernate3
> Type: Bug
> Components: query-criteria
> Versions: 3.1.3
> Reporter: John
> Attachments: hhh1685-example.txt
>
>
> DetachedCriteria has two createCriteria methods:
> public DetachedCriteria createCriteria(String associationPath) throws HibernateException
> public DetachedCriteria createCriteria(String associationPath, String alias) throws HibernateException
> However, the code for both was identical - they called the inner criteria's createCriteria(String) method. The version with the alias did not call the inner's version with the alias. The following patch snipped shows the change:
> public DetachedCriteria createCriteria(String associationPath, String alias)
> throws HibernateException {
> - return new DetachedCriteria( impl, criteria.createCriteria(associationPath) );
> + return new DetachedCriteria( impl, criteria.createCriteria(associationPath, alias) );
> }
> This bug was discovered while trying to link a 2-deep subquery to its parent via aliases. (Surfacing this issue might only be possible with the patch HHH-952 in place - I'm not sure. Seems like a bug regardless, as it definitely fixed my alias reference issue.) I'll get an example posted shortly.
--
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
17 years, 3 months
[Hibernate-JIRA] Created: (ANN-514) Validator doesn't support validation based on value of other fields in the object
by Rakesh Kalra (JIRA)
Validator doesn't support validation based on value of other fields in the object
---------------------------------------------------------------------------------
Key: ANN-514
URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-514
Project: Hibernate Annotations
Type: Improvement
Components: validator
Versions: 3.2.1
Environment: Hibernate Annotations 3.2.1
Reporter: Rakesh Kalra
I really like Hibernate Validator. In the absense of this framework, I was going to write something similar.
But, I see a major limitation. If validation of a field depends on the value of another field in the same object,
hibernate validator doesn't have a way to handle this.
The simplest example is when the validator is used for forms. Forms sometimes have fields like "email" and "retypeEmail".
It would be great to be able to write a custom annotation:
@Match(property="retypeEmail")
public String getEmail(){
return email;
}
where, getRetypeEmail() is also available in the same object.
Another example is where validation of a credit card number, depends on the credit card type
This feature can be implemented, by exposing the object being validated to the isValid() method.
Without changing the signature of this method, the object can be exposed via some kind
of a ValidationContext object, which is stored as a ThreadLocal variable.
Please let me know the best work around, until this feature can be implemented.
Regards,
Rakesh
--
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
17 years, 3 months
[Hibernate-JIRA] Created: (ANN-516) @OrderBy added to wrong table in inheritance relationship
by Martijn Reuvers (JIRA)
@OrderBy added to wrong table in inheritance relationship
---------------------------------------------------------
Key: ANN-516
URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-516
Project: Hibernate Annotations
Type: Bug
Versions: 3.2.1
Environment: Hibernate 3.2.1 GA release, 3.2.1 GA release for hibernate-annotations. Oracle database 10 Release 2.
Reporter: Martijn Reuvers
Attachments: orderby_testcase.zip
Hi Emmanuel,
As promised by John (I forgot my account so he filed the forum :/), hereby a working isolated testcase.
It seems an invalid order-by clause is generated for an inheritance relationship in the following example-case:
Person
OrganisationUser (extends Person)
Organisation has * OrganisationUsers
The method in organisation:
@OneToMany (mappedBy="organisation",
fetch=FetchType.LAZY,
cascade={CascadeType.PERSIST,CascadeType.MERGE})
@OrderBy (value="firstName")
public Set<OrganisationUser> getOrganisationUsers() {
return organisationUsers;
}
The order-by attribute firstName is declared in Person, however the generated sql-query tries to order-by on the organisation-user table. Attached a fully working JDeveloper 10.1.3 project (zipped), if you want to use another IDE, just get the sources out of /database/src, /model/src and /test/src and you're good to go as well. I did not attach any libraries (as these are big), they were in the /libs/src directory, the libraries used to compile and run in that directory are:
ant-antlr-1.6.5.jar
antlr-2.7.6.jar
asm-attrs.jar
asm.jar
cglib-2.1.3.jar
commons-collections-2.1.1.jar
commons-logging-1.0.4.jar
dms.jar (oracle!)
dom4j-1.6.1.jar
ehcache-1.2.3.jar
ejb3-persistence.jar
hibernate-annotations.jar
hibernate3.jar
jta.jar
ojdbc14dms.jar (oracle!)
All are from the hibernate / hibernate annotations distribution releases, with the exception of oracle jdbc drivers. To get quickly started locate the: OrderByTest source file and hibernate.cfg.xml to change your connection, tables.sql contains a script you can directly run in Oracle to get the needed tables.
OrderByTest contains code to fill the tables with some test data and then runs the tests (see comments in OrderByTest).
If you have questions, just let me know.
Thanks!
Martijn
--
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
17 years, 3 months
[Hibernate-JIRA] Created: (HHH-2362) InformixDialect : Informix support offset but the InformixDialect uses max for limit
by Adrian Mitev (JIRA)
InformixDialect : Informix support offset but the InformixDialect uses max for limit
-------------------------------------------------------------------------------------
Key: HHH-2362
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2362
Project: Hibernate3
Type: Improvement
Components: query-hql
Environment: Informix 10
Reporter: Adrian Mitev
Priority: Minor
This is the code in the current version of the InformixDialect:
public boolean useMaxForLimit() {
return true;
}
public boolean supportsLimitOffset() {
return false;
}
public String getLimitString(String querySelect, int offset, int limit) {
if (offset>0) throw new UnsupportedOperationException("informix has no offset");
return new StringBuffer( querySelect.length()+8 ).append(querySelect).insert( querySelect.toLowerCase().indexOf( "select" ) + 6, " first " + limit ).toString();
}
But Informix supports offset ("skip"). Here is the code that should be replaced in the InformixDialect in order to use that informix feature:
public boolean useMaxForLimit() {
return false;
}
public boolean supportsLimitOffset() {
return true;
}
public String getLimitString(String querySelect, int offset, int limit) {
StringBuffer limitString = new StringBuffer(20);
limitString.append((offset > 0) ? " skip " + offset : "");
limitString.append((limit > 0) ? " first " + limit : "");
return new StringBuffer(querySelect.length() + 8).append(querySelect).insert(querySelect.toLowerCase().indexOf("select") + 6,
limitString.toString()).toString();
}
--
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
17 years, 3 months
[Hibernate-JIRA] Deleted: (HHH-2361) connection error
by Christian Bauer (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2361?page=all ]
Christian Bauer deleted HHH-2361:
---------------------------------
> connection error
> ----------------
>
> Key: HHH-2361
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2361
> Project: Hibernate3
> Type: Bug
> Environment: MySgl 4, hibernate 3,tomcat
> Reporter: behnam nejatiyan
>
>
> java.io.EOFException
> STACKTRACE:
> java.io.EOFException
> at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java(Compiled Code))
> at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:1539)
> at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1930)
> at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1168)
> at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1279)
> at com.mysql.jdbc.Connection.execSQL(Connection.java:2281)
> at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1634)
> at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:120)
> at org.hibernate.loader.Loader.getResultSet(Loader.java:1272)
> at org.hibernate.loader.Loader.doQuery(Loader.java:391)
> at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:218)
> at org.hibernate.loader.Loader.doList(Loader.java:1593)
> at org.hibernate.loader.Loader.list(Loader.java:1577)
> at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:111)
> at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1322)
> at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:300)
> at bean.Products.getHomePageList(Products.java:190)
> at org.apache.jsp.index_jsp._jspService(index_jsp.java:67)
> at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java(Compiled Code))
> at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
> at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
> at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java(Compiled Code))
> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java(Compiled Code))
> at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java(Compiled Code))
> at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java(Compiled Code))
> at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java(Compiled Code))
> at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java(Compiled Code))
> at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java(Compiled Code))
> at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java(Compiled Code))
> at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java(Compiled Code))
> at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java(Compiled Code))
> at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java(Compiled Code))
> at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java(Compiled Code))
> at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java(Compiled Code))
> at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java(Compiled Code))
> at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java(Compiled Code))
> at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java(Compiled Code))
> at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java(Compiled Code))
> at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java(Compiled Code))
> at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java(Compiled Code))
> at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java(Compiled Code))
> at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java(Compiled Code))
> at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
> at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
> at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
> at java.lang.Thread.run(Thread.java:567)
--
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
17 years, 3 months
[Hibernate-JIRA] Created: (HHH-2361) connection error
by behnam nejatiyan (JIRA)
connection error
----------------
Key: HHH-2361
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2361
Project: Hibernate3
Type: Bug
Environment: MySgl 4, hibernate 3,tomcat
Reporter: behnam nejatiyan
java.io.EOFException
STACKTRACE:
java.io.EOFException
at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java(Compiled Code))
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:1539)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1930)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1168)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1279)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2281)
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1634)
at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:120)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1272)
at org.hibernate.loader.Loader.doQuery(Loader.java:391)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:218)
at org.hibernate.loader.Loader.doList(Loader.java:1593)
at org.hibernate.loader.Loader.list(Loader.java:1577)
at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:111)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1322)
at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:300)
at bean.Products.getHomePageList(Products.java:190)
at org.apache.jsp.index_jsp._jspService(index_jsp.java:67)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
at javax.servlet.http.HttpServlet.service(HttpServlet.java(Compiled Code))
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
at javax.servlet.http.HttpServlet.service(HttpServlet.java(Compiled Code))
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java(Compiled Code))
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java(Compiled Code))
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java(Compiled Code))
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java(Compiled Code))
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java(Compiled Code))
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java(Compiled Code))
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java(Compiled Code))
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java(Compiled Code))
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java(Compiled Code))
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java(Compiled Code))
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java(Compiled Code))
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java(Compiled Code))
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java(Compiled Code))
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java(Compiled Code))
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java(Compiled Code))
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java(Compiled Code))
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java(Compiled Code))
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java(Compiled Code))
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java(Compiled Code))
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java(Compiled Code))
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
at java.lang.Thread.run(Thread.java:567)
--
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
17 years, 3 months