[Hibernate-JIRA] Created: (HHH-2442) ClassCastException loading from second level cache
by Marcio Moraes (JIRA)
ClassCastException loading from second level cache
--------------------------------------------------
Key: HHH-2442
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2442
Project: Hibernate3
Type: Bug
Components: core
Versions: 3.2.1, 3.2.2, 3.2.0.ga
Environment: Linux 2.6.15-27-686 #1 SMP PREEMPT Fri Dec 8 18:00:07 UTC 2006 i686 GNU/Linux
Reporter: Marcio Moraes
Priority: Blocker
I'm getting a error when using hibernate 3.2.2.ga with cache (JBoss-Cache) cluster.
When hibernate get a entity from second level cache it confuses the arrays of values against array of types.
So in some situations i got ClassCastException ...
Looking up CacheEntry code at assemble method i saw:
private static Object[] assemble(
final Serializable[] values,
final Object result,
final Serializable id,
final EntityPersister persister,
final Interceptor interceptor,
final EventSource session)
throws HibernateException {
//assembled state gets put in a new array (we read from cache by value!)
Object[] assembledProps = TypeFactory.assemble(
values,
persister.getPropertyTypes(),
session, result
);
The issue is values (Serializeble[]) is in wrong order compared with persister.getPropertyTypes() (Type[]).
If only one cache instance is running it doesnt occurs ...
I am using Linux.
Att,
Márcio Moraes
--
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, 5 months
[Hibernate-JIRA] Created: (HBX-974) Unable to recreate tables using Hibernate
by sridhar negi (JIRA)
Unable to recreate tables using Hibernate
------------------------------------------
Key: HBX-974
URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-974
Project: Hibernate Tools
Issue Type: Task
Environment: Oracle 9i.
Reporter: sridhar negi
i m using SchemaUpdate tool of Hibernate.The problem which i m facing is that i had some tables in the database ,now i needed to delete some of the columns from some of the tables. Since UpdateSchema does not allow to delete columns ,i decided to manually drop the those tables from oracle database and recreate those tables. But i m not able to do the same. It tries to fire alter table command, even when there is no such table present in the database..The error whcih i m getting is some thing like this..
[java] alter table POOL_DETAILS add POOL_WEIGHT DOUBLE PRECISION
[java] 52085 DEBUG [main] hbm2ddl.SchemaUpdate - execute alter table POOL_DETAILS add POOL_WEIGHT DOUBLE PRECISION
[java] 52147 ERROR [main] hbm2ddl.SchemaUpdate - execute Unsuccessful: alter table POOL_DETAILS add POOL_WEIGHT DOUBLE PRECISION
[java] 52147 ERROR [main] hbm2ddl.SchemaUpdate - execute ORA-00942: table or view does not exist
--
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, 5 months
[Hibernate-JIRA] Created: (HBX-954) Failing detection of Sequences?
by Vincent Latombe (JIRA)
Failing detection of Sequences?
-------------------------------
Key: HBX-954
URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-954
Project: Hibernate Tools
Issue Type: Bug
Environment: Hibernate3 as provided by Seam 1.2.1GA (dunno which subversion)
Oracle 10g
Reporter: Vincent Latombe
Here is my problem : I used reverse engineering to get an entity from a table in a database.
I got my entity then I wanted to add a generation for the Id. Fine, I add HIBERNATE_SEQUENCE which is needed then I add the annotation to my entity.
I get this :
@Id
@Column(name = "ID", precision = 22, scale = 0)
@GeneratedValue(strategy=GenerationType.SEQUENCE)
@NotNull
public long getId() {
return this.id;
}
Nothing really difficult. Then I try to deploy my ejb using the validate strategy of hbm2ddl. And it fails because it can't find the sequence ([DatabaseMetadata] table not found: TESTSEAM.hibernate_sequence)... Ok strange. Then I switch to the update strategy... Now I get something interesting.
14:40:12,843 INFO [DatabaseMetadata] table not found: TESTSEAM.hibernate_sequence
14:40:12,843 INFO [DatabaseMetadata] table not found: hibernate_sequence
14:40:12,875 ERROR [SchemaUpdate] Unsuccessful: create sequence TESTSEAM.hibernate_sequence
14:40:12,875 ERROR [SchemaUpdate] ORA-00955: ce nom d'objet existe dÚjÓ
14:40:12,875 INFO [SchemaUpdate] schema update complete
It seems that DatabaseMetadata try to lookup a table instead of a sequence, so it can't detect the already existing sequence. So then it tries to create the sequence but it already exists. Any clue?
--
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, 5 months
[Hibernate-JIRA] Created: (HHH-2463) ClassCastException when Hibernate tries to cache results using ResultTransformer
by Peak user (JIRA)
ClassCastException when Hibernate tries to cache results using ResultTransformer
--------------------------------------------------------------------------------
Key: HHH-2463
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2463
Project: Hibernate3
Type: Bug
Versions: 3.2.2
Reporter: Peak user
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 problem could be easily solved if Hibernate cached results before applying the ResultTransformer instead of afterwards.
Here's a sample code to reproduce this problem:
class ToMapResultTransformer implements ResultTransformer {
private String[] properties;
public ToMapResultTransformer(String[] properties) {
this.properties = properties;
}
public List transformList(List collection) {
return collection;
}
public Object transformTuple(Object[] tuple, String[] aliases) {
Map<String,Object> result = new HashMap<String,Object>(tuple.length);
for (int i=0; i<tuple.length; i++) {
result.put((properties != null ? properties[i] : aliases[i]), tuple[i]);
}
return result;
}
}
Criteria sqlCriteria = createSqlCriteria(session);
sqlCriteria.setProjection(projections);
sqlCriteria.setCacheable(true);
sqlCriteria.setResultTransformer(new ToMapResultTransformer(properties));
sqlCriteria.list();
The code above produces the following exception:
java.lang.ClassCastException: java.util.HashMap
at org.hibernate.cache.StandardQueryCache.put(StandardQueryCache.java:83)
at org.hibernate.loader.Loader.putResultInQueryCache(Loader.java:2185)
at org.hibernate.loader.Loader.listUsingQueryCache(Loader.java:2129)
at org.hibernate.loader.Loader.list(Loader.java:2087)
at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:94)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1569)
at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283)
--
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, 5 months
[Hibernate-JIRA] Created: (HHH-2525) Bug when using a ResultTransformer on a cached query
by Sebastien Cesbron (JIRA)
Bug when using a ResultTransformer on a cached query
----------------------------------------------------
Key: HHH-2525
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2525
Project: Hibernate3
Issue Type: Bug
Components: core
Affects Versions: 3.2.2
Environment: Firebird 2.0 on Win XP
Reporter: Sebastien Cesbron
Attachments: testhib.zip
Using a distinct result transformer which a cached like this :
query = session.createQuery("select obj from ObjetTest obj left outer join fetch obj.children as obj_0 order by obj.id asc");
query.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);
query.setCacheable(true);
query.list();
This leads to this exception
2007-03-21 14:28:20,589 ERROR : IllegalArgumentException in class: ObjetTest, getter method of property: oid
Exception in thread "main" org.hibernate.PropertyAccessException: IllegalArgumentException occurred calling getter of ObjetTest.oid
at org.hibernate.property.BasicPropertyAccessor$BasicGetter.get(BasicPropertyAccessor.java:171)
at org.hibernate.tuple.entity.AbstractEntityTuplizer.getIdentifier(AbstractEntityTuplizer.java:183)
at org.hibernate.persister.entity.AbstractEntityPersister.getIdentifier(AbstractEntityPersister.java:3524)
at org.hibernate.persister.entity.AbstractEntityPersister.isTransient(AbstractEntityPersister.java:3240)
at org.hibernate.engine.ForeignKeys.isTransient(ForeignKeys.java:181)
at org.hibernate.engine.ForeignKeys.getEntityIdentifierIfNotUnsaved(ForeignKeys.java:218)
at org.hibernate.type.ManyToOneType.disassemble(ManyToOneType.java:163)
at org.hibernate.cache.StandardQueryCache.put(StandardQueryCache.java:80)
at org.hibernate.loader.Loader.putResultInQueryCache(Loader.java:2118)
at org.hibernate.loader.Loader.listUsingQueryCache(Loader.java:2062)
at org.hibernate.loader.Loader.list(Loader.java:2020)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:393)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)
at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
at Test.main(Test.java:33)
Caused by: java.lang.IllegalArgumentException: object is not an instance of declaring class
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.hibernate.property.BasicPropertyAccessor$BasicGetter.get(BasicPropertyAccessor.java:145)
... 16 more
It seems this is due to a difference in QueryLoader.getResultColumnOrRow. In this method there is a test :
else if ( !hasTransform ) {
return row.length == 1 ? row[0] : row;
}
This causes the method to return an instance of ObjetTest in one case and an instance of ObjetTest[1] in the other one. In the latter test, when putting the query into the query cache, hibernate calls the getOid method on an array of ObjetTest and this causes the exception
--
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, 5 months