[Hibernate-JIRA] Created: (HHH-5163) ClassCastException when Hibernate tries to cache results using ResultTransformer
by Strong Liu (JIRA)
ClassCastException when Hibernate tries to cache results using ResultTransformer
--------------------------------------------------------------------------------
Key: HHH-5163
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5163
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.5.1
Reporter: Strong Liu
Assignee: Gail Badner
Fix For: 3.5.x, 3.6
When Hibernate executes a cacheable query using a ResultTransformer, it will attempt to cache the results AFTER applying the ResultTransformer. The problem is that the ResultTransformer may modify the data in a way that Hibernate won't understand it anymore, and in this case it will generate a ClassCastException when trying to cache it.
---------------------------
this can be reproduced by CriteriaQueryTest with following change:
papa-pc:testsuite stliu$ svn diff src/test/java/org/hibernate/test/criteria/CriteriaQueryTest.java
Index: src/test/java/org/hibernate/test/criteria/CriteriaQueryTest.java
===================================================================
--- src/test/java/org/hibernate/test/criteria/CriteriaQueryTest.java (revision 19246)
+++ src/test/java/org/hibernate/test/criteria/CriteriaQueryTest.java (working copy)
@@ -613,6 +613,7 @@
)
.addOrder( Order.desc("studentName") )
.setResultTransformer( Transformers.aliasToBean(StudentDTO.class) )
+ .setCacheable( true )
.list();
assertEquals(2, resultWithAliasedBean.size());
--
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
14 years, 10 months
[Hibernate-JIRA] Created: (HHH-5810) Database MYSQL supports recursive but populate doesn't work
by Raul Romanillos Llorente (JIRA)
Database MYSQL supports recursive but populate doesn't work
-----------------------------------------------------------
Key: HHH-5810
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5810
Project: Hibernate Core
Issue Type: Task
Components: query-sql
Affects Versions: 3.3.0.GA
Environment: Hibernate 3.3.0 GA, MySQL 5.1.41
Reporter: Raul Romanillos Llorente
After running on the screen we see that the field_3 field_1 fields have the same value.
Hibernate has the same value assigned to the fields valueField_1, valueField_2 and valueField_3 and the database are different values.
Hibernate did not return good results with createSQLQuery (query).
...
String query = "SELECT i.id_route, i.route_name, ii.route_name, iii.route_name,";
query += " FROM routes i";
query += " LEFT JOIN routes ii ON i.id_route_parent=i.id_route";
query += " LEFT JOIN routes iii ON ii.id_route_parent=iii.id_route
tx = session.getTransaction();
tx.begin();
result = session.createSQLQuery(query).list();
tx.commit();";
String valueField_0, valueField_1, valueField_2, valueField_3;
if (result!=null) {
for (Object obj: result) {
Object [] cols= (Object []) irObj;
valueField_0=(cols[0]!=null?cols[0].toString():"");
valueField_1=(cols[1]!=null?cols[1].toString():"");
valueField_2=(cols[2]!=null?cols[2].toString():"");
valueField_3=(cols[3]!=null?cols[3].toString():"");
System.out.println("field_1:"+valueField_1+"\nfield_2:"+valueField_2+"\nfield_3:"+valueField_3);
}
}
--
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
14 years, 11 months
[Hibernate-JIRA] Created: (HSEARCH-642) Support for only manual indexing of particular entity types
by Kyrill Alyoshin (JIRA)
Support for only manual indexing of particular entity types
-----------------------------------------------------------
Key: HSEARCH-642
URL: http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-642
Project: Hibernate Search
Issue Type: Improvement
Components: engine
Affects Versions: 3.2.1
Reporter: Kyrill Alyoshin
I have an interesting use case. Basically I have to find internal duplicates (in full text search terms) among a bunch of entities of a particular type. The most elegant way to do it, would be:
1. Not to index those entities when they are saved (the problem is that only a minority of entities need to be de-duped).
2. Before de-duping process starts, manually index those particular entities.
3. De-dupe them using Lucene's capabilities.
4. Purge those entities from the index.
Is it possible to mark a particular entity to be indexed only manually?
hibernate.search.indexing_strategy = manual
seems to be a global configuration. Can it be applied somehow on a per entity basis? If not, I think this is a valuable RFE.
--
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
14 years, 11 months
[Hibernate-JIRA] Created: (HHH-3872) Criteria on alias causes partial collection materialization
by Adrian Moos (JIRA)
Criteria on alias causes partial collection materialization
-----------------------------------------------------------
Key: HHH-3872
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3872
Project: Hibernate Core
Issue Type: Bug
Components: query-criteria
Affects Versions: 3.3.0.CR1
Reporter: Adrian Moos
I have a parent entity with a one-to-many assocation to a child entity:
<hibernate-mapping package="ch.bedag.a11.ccinfo.business.entity" default-lazy="false">
<class name="Parent" table="PARENT">
<id name="id" type="long" column="ID" unsaved-value="null">
<generator class="sequence">
<param name="sequence">SEQ_T_PARENT</param>
</generator>
</id>
<set name="children" cascade="all-delete-orphan" inverse="true">
<key column="PARENT_ID" foreign-key="CHILD_FK1"/>
<one-to-many class="Child"/>
</set>
</class>
<class name="Child"
<id name="id" type="long" column="ID" unsaved-value="null">
<generator class="sequence">
<param name="sequence">SEQ_T_CHILD</param>
</generator>
</id>
<property name="businessKey" column="BUSINESSKEY" not-null="true"/>
</class>
</hibernate-mapping>
I then do:
Criteria parentCriteria = aSession.createCriteria(Parent.class);
parentCriteria.createAlias("children", "c", CriteriaSpecification.LEFT_JOIN);
parentCriteria.setResultTransformer(CriteriaSpecification.DISTINCT_ROOT_ENTITY);
parentCriteria.add(Restrictions.eq("c.businessKey", 123456789));
List parents = parentCriteria.list();
Expected behaviour: Since each parent in parents is a materialized entity, I'd expect its children set to contain all its children.
Observed behaviour: It contains only children with matching business key.
Is my expectation correct?
--
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
14 years, 11 months
[Hibernate-JIRA] Created: (HHH-5550) Hibernate.createBlob() fails when used in current_session_context_class=thread mode
by Zemian Deng (JIRA)
Hibernate.createBlob() fails when used in current_session_context_class=thread mode
-----------------------------------------------------------------------------------
Key: HHH-5550
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5550
Project: Hibernate Core
Issue Type: Bug
Affects Versions: 3.5.5
Reporter: Zemian Deng
See https://forum.hibernate.org/viewtopic.php?f=1&t=1004366
Here is a unit test failed case:
{code:java}
package deng.hibernate.examples.blob;
import org.hibernate.*;
import org.hibernate.cfg.*;
import org.junit.Test;
public class HibernateCreateBlobFailedCase {
@Test
public void createBlob() {
Configuration cfg = new Configuration();
SessionFactory sessionFactory = cfg.configure().buildSessionFactory();
Session session = sessionFactory.getCurrentSession();
Transaction tx = null;
try {
tx = session.beginTransaction();
byte[] blobBytes = new byte[]{};
Hibernate.createBlob(blobBytes, session);
} catch (Throwable e) {
tx.rollback();
throw new RuntimeException(e);
} finally {
sessionFactory.close();
}
}
}
{code}
Set hibernate.cfg.xml with thread session context
{code:xml}
...
<property name="current_session_context_class">thread</property>
...
{code}
You will get this stack trace
{noformat}
java.lang.RuntimeException: java.lang.ClassCastException: $Proxy4 cannot be cast to org.hibernate.engine.jdbc.LobCreationContext
at deng.hibernate.examples.blob.HibernateCreateBlobFailedCase.createBlob(HibernateCreateBlobFailedCase.java:24)
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:597)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.lang.ClassCastException: $Proxy4 cannot be cast to org.hibernate.engine.jdbc.LobCreationContext
at org.hibernate.Hibernate.getLobCreator(Hibernate.java:502)
at org.hibernate.Hibernate.getLobCreator(Hibernate.java:498)
at org.hibernate.Hibernate.createBlob(Hibernate.java:494)
at deng.hibernate.examples.blob.HibernateCreateBlobFailedCase.createBlob(HibernateCreateBlobFailedCase.java:21)
... 22 more
{noformat}
As described in forum, this problem occurred because the session object we get using {{sessionFactory.getCurrentSession();}} is an wrapped ThreadLocalSessionContext instance that can not be cast into LobCreationContext. There is no easy way to unwrap and get the original session object, to pass to createBlob method.
--
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
14 years, 11 months
[Hibernate-JIRA] Created: (HHH-5430) Better Firebird support - temp tables, short column names
by Martin Černý (JIRA)
Better Firebird support - temp tables, short column names
---------------------------------------------------------
Key: HHH-5430
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5430
Project: Hibernate Core
Issue Type: Improvement
Components: core
Affects Versions: 3.5.3
Reporter: Martin Černý
Priority: Minor
Attachments: Firebird21Dialect.java, GenericLengthLimitedNamingStrategy.java, LengthLimitedComponentSafeNamingStrategy.java
Sorry for not posting in some more concise format or joining the development in an official way, however I hope it still helps.
In my quest to make Firebird work with my Hibernate/JPA project I have developed two helper classes that (especially the first one) might as well be incorporated in the Hibernate.
First I have subclassed FirebirdDialect to make use of temporary table support in Firebird 2.1 (this had blocked some of the JPA features)
Then I have subclassed NamingStrategy to create a generic strategy that forces all the database identifiers to conform to certain length. This is needed since Firebird does not work with column and table names longer than 30 chars. Although I am not certain, if this should be part of Hibernate.
The class I created are attached, their utility is up to the consideration of the community
--
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
14 years, 11 months
[Hibernate-JIRA] Created: (HHH-3230) getEntityName() throws org.hibernate.TransientObjectException: proxy was not associated with the session
by Howard M. Lewis Ship (JIRA)
getEntityName() throws org.hibernate.TransientObjectException: proxy was not associated with the session
--------------------------------------------------------------------------------------------------------
Key: HHH-3230
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3230
Project: Hibernate3
Issue Type: Bug
Components: core
Affects Versions: 3.2.2
Environment: Mac OS X, JDK 1.5
Reporter: Howard M. Lewis Ship
I'm retrieving an entity that contains a OneToMany relationship.
The master entity is retrieved, within a transaction, via Session.get(Class,Serializable).
@Entity
public class MapUnitSurvey extends ActiveDO
{
@ManyToOne(fetch = FetchType.LAZY)
private VegetationType vegetationType;
}
@Entity
public class VegetationType extends AbstractEnum
{
}
ActiveDO and AbstractEnum are abstract base classes with @MappedSuperclass.
I retrieve the vegationType:
VegetationType type = survey.getVegetationType();
Then I need the type's entity name
String entityName = session.getEntityName(type);
This fails with the TransientObjectException.
Inspecting with the debugger, I see that type is a CGLIB-enhanced proxy, and that there's a fully initialized bean in the target field of the proxy. I'll attach a screenshot of some debugging data.
In summary; the entity was retrieved via a lazy fetch, appears the be correct, seems to be in the session and yet the exception occurs.
I've tried to resolve this by re-fetching the object from the session, and a few other tries, with no luck.
--
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
14 years, 11 months