[Hibernate-JIRA] Created: (HV-284) Documentation fixes for hibernate-core integration
by Mathias De Belder (JIRA)
Documentation fixes for hibernate-core integration
--------------------------------------------------
Key: HV-284
URL: http://opensource.atlassian.com/projects/hibernate/browse/HV-284
Project: Hibernate Validator
Issue Type: Patch
Components: documentation
Affects Versions: 4.0.2.GA
Environment: Hibernate Validator 4.0.2
Hibernate Core 3.5.0-beta2
Reporter: Mathias De Belder
Assignee: Hardy Ferentschik
Priority: Trivial
Attachments: integration.patch
In Hibernate Validator's documentation on integrating the validator implementation with other ORM frameworks (§6.2.1) the 'manual configuration' XML linked as 'Example 6.1' contains two errors. First, the 'Default' Validator group resides in javax.validation.groups.Default instead of javax.validation.Default. Secondly, the <event> listener registration needs to appear before the closing </session-factory> tag.
The attached patch modifies the Docbook source to produce a working hibernate.cfg.xml.
--
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
16 years, 1 month
[Hibernate-JIRA] Created: (HHH-4882) restricting polymorphic query results
by Domenico Loiacono (JIRA)
restricting polymorphic query results
-------------------------------------
Key: HHH-4882
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4882
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.5.0-Beta-4
Environment: JPA 2.0, Hibernate 3.5.0-Beta4, MySQL 5.1, Glassfish v3.
Reporter: Domenico Loiacono
I want to limit the polymorphic query results using JPA 2.0 syntax (TYPE) :
SELECT e FROM Employee e WHERE TYPE(e) IN (FullTime, Executive)
but it seems that Hibernate 3.5.0-Beta4 doesn't support this syntax because in the generated sql query the 'type' keyword remains unmapped and MySQL throws an Exception:
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(type(employee0_.id) in (5))' at line 1
So I tried with Criteria API:
CriteriaBuilder criteriaBuilder = em.getCriteriaBuilder();
CriteriaQuery<Employee> criteria = criteriaBuilder.createQuery(Employee.class);
Root<Employee> employee= criteria.from(Employee.class);
criteria.where(employee.type().in(FullTime.class,Executive.class));
But I received an Exception:
Caused by: java.lang.IllegalArgumentException: Unexpected call on EntityTypeExpression#render
at org.hibernate.ejb.criteria.expression.PathTypeExpression.render(PathTypeExpression.java:48)
at org.hibernate.ejb.criteria.predicate.InPredicate.render(InPredicate.java:164)
at org.hibernate.ejb.criteria.QueryStructure.render(QueryStructure.java:258)
at org.hibernate.ejb.criteria.CriteriaQueryImpl.render(CriteriaQueryImpl.java:340)
at org.hibernate.ejb.criteria.CriteriaQueryCompiler.compile(CriteriaQueryCompiler.java:150)
at org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:416)
at com.sun.enterprise.container.common.impl.EntityManagerWrapper.createQuery(EntityManagerWrapper.java:489)
So I opened the PathTypeExpression class and in the render method I saw :
public String render(CriteriaQueryCompiler.RenderingContext renderingContext) {
// todo : is it valid for this to get rendered into the query itself?
throw new IllegalArgumentException( "Unexpected call on EntityTypeExpression#render" );
}
Then I switched to use Hibernate custom query syntax (class) :
SELECT e FROM Employee e WHERE (e.class) IN (FullTime, Executive)
Ok this works fine.
But when I add a join with another entity (Department) that has the same TABLE_PER_CLASS inheritance strategy of entity Employee, I have a new problem:
SELECT e FROM Employee e JOIN e.departments d WHERE d.code = 'D1' and (e.class) IN (FullTime, Executive)
GRAVE: Column 'clazz_' in where clause is ambiguous
Caused by: javax.persistence.PersistenceException: org.hibernate.exception.ConstraintViolationException: could not execute query
--
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
16 years, 1 month
[Hibernate-JIRA] Created: (HHH-4916) Literal with JDBC escape syntax for date doesn't work
by Juergen Zimmermann (JIRA)
Literal with JDBC escape syntax for date doesn't work
-----------------------------------------------------
Key: HHH-4916
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4916
Project: Hibernate Core
Issue Type: Bug
Components: entity-manager
Affects Versions: 3.5.0-CR-1
Reporter: Juergen Zimmermann
I'm having an entity with a java.util.Date attribute:
@Entity
public class Kunde implements Serializable {
@Temporal(DATE)
private Date seit;
...
}
The following named query crashes, when a Date literal is used for parameter instantiation:
SELECT k
FROM Kunde k
WHERE k.seit = :seit
Here is the stacktrace:
java.lang.IllegalArgumentException: Parameter value [{d '2001-01-31'}] was not matching type [java.util.Date]
at org.hibernate.ejb.AbstractQueryImpl.registerParameterBinding(AbstractQueryImpl.java:354)
at org.hibernate.ejb.QueryImpl.setParameter(QueryImpl.java:354)
at org.hibernate.ejb.QueryImpl.setParameter(QueryImpl.java:71)
--
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
16 years, 1 month
[Hibernate-JIRA] Created: (HHH-4914) How to pass values to Named Query dynamically in Hibernate
by kalyan buddala (JIRA)
How to pass values to Named Query dynamically in Hibernate
----------------------------------------------------------
Key: HHH-4914
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4914
Project: Hibernate Core
Issue Type: Bug
Affects Versions: 3.1
Reporter: kalyan buddala
I need to create a dynamic query based on the some condition. I don't want to hardcode this query in my java class.
So that's the reason i want to get this using Named query in hibernate.
Below is how iam trying to implement.
DateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String today = sdf.format(date);
Query query = session.getNamedQuery("findDateDifference");
query.setString(1, today);
List date_Diff_List = query.list();
<sql-query name="findDateDifference"><![CDATA[
select (? - temp.bv_date) as days from
( select CLO_DTE as bv_date from BRAND ) temp]]>
</sql-query>
I need to pass the value to the '?' which is given in above query.
When I run the above code it gives me error as below.
Can anyone please give me some suggestions how to fix this issue.
Hibernate:
select (? - temp.bv_date) as days from
( select CLO_DTE as bv_date from BRAND ) temp
org.hibernate.exception.SQLGrammarException: could not execute query
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:59)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.loader.Loader.doList(Loader.java:1502)
at org.hibernate.loader.Loader.list(Loader.java:1482)
at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:103)
at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1333)
at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:146)
at com.hibernate.ExceptionTest.getDateDifference(ExceptionTest.java:219)
at com.hibernate.ExceptionTest.main(ExceptionTest.java:43)
Caused by: com.ibm.db2.jcc.a.SqlException: DB2 SQL error: SQLCODE: -171, SQLSTATE: 42815, SQLERRMC: 2;-
at com.ibm.db2.jcc.a.hd.e(hd.java:1659)
at com.ibm.db2.jcc.a.hd.a(hd.java:1235)
at com.ibm.db2.jcc.a.hd.a(hd.java:1221)
at com.ibm.db2.jcc.c.jb.h(jb.java:142)
at com.ibm.db2.jcc.c.jb.a(jb.java:43)
at com.ibm.db2.jcc.c.w.a(w.java:30)
at com.ibm.db2.jcc.c.cc.g(cc.java:160)
at com.ibm.db2.jcc.a.hd.n(hd.java:1215)
at com.ibm.db2.jcc.a.id.gb(id.java:1780)
at com.ibm.db2.jcc.a.id.d(id.java:2255)
at com.ibm.db2.jcc.a.id.X(id.java:505)
at com.ibm.db2.jcc.a.id.executeQuery(id.java:488)
at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:107)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1183)
at org.hibernate.loader.Loader.doQuery(Loader.java:363)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:203)
at org.hibernate.loader.Loader.doList(Loader.java:1499)
... 6 more
--
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
16 years, 2 months