[
http://opensource.atlassian.com/projects/hibernate/browse/ANN-660?page=co...
]
Jacek Halat commented on ANN-660:
---------------------------------
Source of problem is in code:
StandardQueryCache.put method
(...)
List cacheable = new ArrayList( result.size()+1 );
cacheable.add( ts );
for ( int i=0; i<result.size(); i++ ) {
if ( returnTypes.length==1 ) {
cacheable.add( returnTypes[0].disassemble( result.get(i), session, null ) );
}
else {
cacheable.add( TypeFactory.disassemble( (Object[]) result.get(i), returnTypes, null,
session, null ) );
}
}
(...)
Most important line is
cacheable.add( returnTypes[0].disassemble( result.get(i), session, null ) );
JavaDoc from Type.disassemble says:
/**
* Return a cacheable "disassembled" representation of the object.
* @param value the value to cache
* @param session the session
* @param owner optional parent entity object (needed for collections)
* @return the disassembled, deep cloned state
*/
public Serializable disassemble(Object value, SessionImplementor session, Object owner)
throws HibernateException;
so third parameter (owner) is not needed for non-collections, but for collections this is
needed parameter!! And in actual code this parameter is always null.....
If we run i.e. this query: [select s from SubItem s] Result contains exactly this same
objects (Subitem), but return type is ManyToOneType. (and this works correctly). So now is
a question: If ManyToOneType return type works correctly, how should work BagType? There
are 2 possibilities:
a) There is wrong return type provided to put method
b) For BagType owner should be extracted
HHH-2545 Alive
--------------
Key: ANN-660
URL:
http://opensource.atlassian.com/projects/hibernate/browse/ANN-660
Project: Hibernate Annotations
Issue Type: Bug
Affects Versions: 3.3.0.ga
Environment: Gentoo Linux x86
JDK: 1.6. SUN and BEA
JBoss-4.2.1.GA
Hibernate: 3.2.5
Annotation: 3.3.0.GA
EntityManager: 3.3.1
Reporter: Eugene Batogov
Priority: Critical
Attachments: testcase_ANN-660.zip
Original Estimate: 1 hour
Remaining Estimate: 1 hour
I have a same problem how in HHH-2545 bug !
I update Hibernate to 3.2.5, hibernate-annotation to 3.3.0.GA
hibernate-entitymanager to 3.3.1.GA.
But this bug alive!
I use ehcache-1.3.0. jBoss-4.2.1.GA.
My query, which get from cache with null elements in collections:
Long customerAccount = customerIdentity.getCustomerAccount().getId();
try{
String sql = "select npvr.npvrChannels from NpvrServiceSpec
npvr"+
" where npvr.id in ("+
" select ss.id from Customer cust join cust.accounts acc join
cust.subscriptions sub"+
" join sub.serviceSpecifications ss"+
" where acc.id =:customerAccount and"+
" ss in (from NpvrServiceSpec))";
Query query = emanager.createQuery(sql);
query.setParameter("customerAccount", customerAccount);
query.setHint("org.hibernate.cacheRegion",
"query.findQueryNpvrChannelsBySubsription");
query.setHint("org.hibernate.cacheable", true);
result = query.getResultList();
Help me, please !
Thanks in advance.
--
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