[Hibernate-JIRA] Created: (HHH-5735) Usage Path.type() in expressions throws java.lang.IllegalArgumentException
by Jaroslaw Lewandowski (JIRA)
Usage Path.type() in expressions throws java.lang.IllegalArgumentException
---------------------------------------------------------------------------
Key: HHH-5735
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5735
Project: Hibernate Core
Issue Type: Bug
Components: query-criteria
Affects Versions: 3.6.0, 3.6.1
Reporter: Jaroslaw Lewandowski
Priority: Blocker
Attachments: InheritanceTest.tgz
It is not possible to filter entities using Path.type() in Criteria Query API. Using type() in expressions throws an exception:
Unexpected call on EntityTypeExpression#render
java.lang.IllegalArgumentException: Unexpected call on EntityTypeExpression#render
at org.hibernate.ejb.criteria.expression.PathTypeExpression.render( at org.hibernate.ejb.criteria.expression.PathTypeExpression.render(PathTypeExpression.java:48PathTypeExpression.java:48)
)
at org.hibernate.ejb.criteria.predicate.ComparisonPredicate.render(ComparisonPredicate.java:173)
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:223)
at org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:441)
at foo.InheritanceTest.critQryTest(InheritanceTest.java:55)
Test case is attached and it's similar to an example from JPA 2.0 specification - chapter 6.5.7 Example 2:
CriteriaQuery<Employee> q = cb.createQuery(Employee.class);
Root<Employee> emp = q.from(Employee.class);
q.select(emp)
.where(cb.notEqual(emp.type(), Exempt.class));
--
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
13 years, 7 months
[Hibernate-JIRA] Created: (HHH-5742) PersistentSet#iterator() iterates over element which had been removed from set
by Guenther Demetz (JIRA)
PersistentSet#iterator() iterates over element which had been removed from set
------------------------------------------------------------------------------
Key: HHH-5742
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5742
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.6.0, 3.5.0-Final
Environment: 3.6.0FINAL, database indipendent (attached testcase based on hsqldb)
Reporter: Guenther Demetz
Priority: Critical
Attachments: TestIterateOverExtraLazyCollectionWithInverseOwner.jar
PRECONDITONS:
-the relation is declared OneToMany with inverse owner (=mappedBy attribute specified)
-the relation is declared extra lazy @LazyCollection (LazyCollectionOption.EXTRA)
BUG: PersistenSet.iterator().next() returns element which previously had been removed from the set
myPersistenSet.remove(obj);
assertFalse(myPersistenSet.iterator().next() == obj);
CAUSE:
PersistentSet#iterator() implementation does differ from PersistentSet#contains() and PersistentSet#size() as it doesn't call the necessary flush() if:
- the set isn't initialized
- the set is declared extra lazy
- the set has queued Operations (hasQueuedOperations == true) to be flushed
Please see attached TESTCASE for more details.
This IMHO is a critical bug, as it could create serious damage to companies using hibernate:
imagine a company cancels a order-position and nevertheless the canceled position is subsequently delivered or/and invoiced to the customer, because the iterator returns the removed element.
Thanks for attention.
--
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
13 years, 7 months
[Hibernate-JIRA] Created: (HHH-5811) flush causes update query on field of type Byte[]
by K C (JIRA)
flush causes update query on field of type Byte[]
-------------------------------------------------
Key: HHH-5811
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5811
Project: Hibernate Core
Issue Type: Bug
Components: entity-manager
Affects Versions: 3.6.0
Environment: Hibernate 3.6.0.Final, Oracle 11g
Reporter: K C
I have a field that is mapped as follows:
@Lob
@Column(name = "picture")
private Byte[] picture;
When retrieving the entity with a regular session.load() or criteria.list(), upon session flush, an update statement is issued for the field.
In an interceptor, I can see in the onFlushDirty method that the byte arrays in the currentState en previousState parameters are different objects, but with the same byte-content. All the other objects in currentState and previousState are identical.
My guess is that this causes Hibernate to think the contents of the field changed?
This behavior did not happen in 3.5.5-Final, and because the entity is versioned, upon each retrieval, the version field is incremented, which is highly undesirable.
--
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
13 years, 7 months
[Hibernate-JIRA] Created: (HHH-5574) HQL ORDER BY descending component is not generated properly; DESC is only applied to the last component column
by Gail Badner (JIRA)
HQL ORDER BY descending component is not generated properly; DESC is only applied to the last component column
---------------------------------------------------------------------------------------------------------------
Key: HHH-5574
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5574
Project: Hibernate Core
Issue Type: Bug
Components: query-hql
Affects Versions: 3.6.0.CR1, 3.5.6
Reporter: Gail Badner
Assignee: Gail Badner
Fix For: 3.6.x
HQL ORDER BY descending component is not generated properly; DESC is only applied to the last component column.
For example:
HQL: select z.name, z.address from org.hibernate.test.hql.Zoo z order by z.address DESC, z.name DESC
SQL: select
zoo0_.name as col_0_0_,
zoo0_.street as col_1_0_,
zoo0_.city as col_1_1_,
zoo0_.postalCode as col_1_2_,
zoo0_.country as col_1_3_,
zoo0_.state_prov_id as col_1_4_
from
Zoo zoo0_
order by
zoo0_.street,
zoo0_.city,
zoo0_.postalCode,
zoo0_.country,
zoo0_.state_prov_id DESC,
zoo0_.name DESC
--
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
13 years, 7 months
[Hibernate-JIRA] Created: (HHH-5849) AbstractQueryImpl loads non readOnly entity with session.setDefaultReadOnly(true)
by Jan Hodac (JIRA)
AbstractQueryImpl loads non readOnly entity with session.setDefaultReadOnly(true)
---------------------------------------------------------------------------------
Key: HHH-5849
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5849
Project: Hibernate Core
Issue Type: Bug
Components: query-hql, query-sql
Affects Versions: 3.6.0
Reporter: Jan Hodac
When I need all loaded entities to be readOnly I use session.setDefaultReadOnly(true);
Example:
@javax.persistence.NamedQuery(name="TEST", query="select p from Person p")
session.setDefaultReadOnly(true);
Object object = session.getNamedQuery("TEST").uniqueResult();
assertEquals(true,session.isReadOnly(object));
but entity loaded by named query is non readOnly
Problem is in AbstractQueryImpl#isReadOnly(). Field readOnly never can be null
/**
* {@inheritDoc}
*/
public boolean isReadOnly() {
return ( readOnly == null ?
getSession().getPersistenceContext().isDefaultReadOnly() :
readOnly.booleanValue()
);
}
/**
* {@inheritDoc}
*/
public Query setReadOnly(boolean readOnly) {
this.readOnly = Boolean.valueOf( readOnly );
return this;
}
--
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
13 years, 7 months
[Hibernate-JIRA] Created: (HHH-4760) NotAuditedException occurs when auditReader.getRevisions() is called for javassist proxies
by Erik-Berndt Scheper (JIRA)
NotAuditedException occurs when auditReader.getRevisions() is called for javassist proxies
------------------------------------------------------------------------------------------
Key: HHH-4760
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4760
Project: Hibernate Core
Issue Type: Bug
Components: envers
Affects Versions: 3.5.0-Beta-2
Reporter: Erik-Berndt Scheper
NotAuditedException occurs when auditReader.getRevisions() is called for javassist proxies
In my code I see the following stacktrace if I try to retrieve the revision of a javassist proxy:
org.hibernate.envers.exception.NotAuditedException: nl.ibgroep.bap.model.domain.persoon.Ouder_$$_javassist_1 is not versioned!
at org.hibernate.envers.reader.AuditReaderImpl.getRevisions(AuditReaderImpl.java:126)
at nl.ibgroep.bap.dao.impl.AuditRevisionJpaDaoImpl.getRevisionsFor(AuditRevisionJpaDaoImpl.java:58)
Ouder_$$_javassist_1.class is a Hibernate generated javassist proxy for Ouder.class, which is versioned.
Code:
AuditReader vr = AuditReaderFactory.get(this.entityManager);
Class clazz = persistentObject.getClass();
List<Number> revisionNumbers = vr.getRevisions(clazz, persistentObject.getId());
I am able to work around this issue with the following code:
AuditReader vr = AuditReaderFactory.get(this.entityManager);
Class clazz = persistentObject.getClass();
if (persistentObject instanceof javassist.util.proxy.ProxyObject) {
if (LOGGER.isDebugEnabled()) {
StringBuilder output = new StringBuilder("Found javassist ProxyObject for revision: class= ");
output.append(clazz.getSimpleName());
output.append("; superclass= ").append(clazz.getSuperclass().getSimpleName());
output.append("; interfaces= ").append(Arrays.asList(clazz.getInterfaces()).toString());
LOGGER.debug(output.toString());
}
clazz = clazz.getSuperclass();
}
List<Number> revisionNumbers = vr.getRevisions(clazz, persistentObject.getId());
However, a fix in envers would be greatly appreciated.
--
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
13 years, 7 months