[Hibernate-JIRA] Created: (HHH-5255) Bytecode instrumented byte[] lazy properties do not work
by Kyrill Alyoshin (JIRA)
Bytecode instrumented byte[] lazy properties do not work
--------------------------------------------------------
Key: HHH-5255
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5255
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.5.2
Environment: Hibernate-3.5.2, Oracle 10g
Reporter: Kyrill Alyoshin
Well, I have an entity that stores a byte[] property as a Blob.
@Lob
@Basic(optional = false, fetch = FetchType.LAZY)
public byte[] getContent() {
return content;
}
The content can be pretty large, so I marked it as lazy and to enable lazy property fetching I am instrumenting the class at build-time using org.hibernate.tool.instrument.javassist.InstrumentTask just as the documentation says.
However, when I call session.merge on this entity, I can get this stacktrace:
java.lang.ClassCastException: org.hibernate.intercept.LazyPropertyInitializer$1 cannot be cast to [B
at org.hibernate.type.AbstractLongBinaryType.toInternalFormat(AbstractLongBinaryType.java:46)
at org.hibernate.type.AbstractBynaryType.isEqual(AbstractBynaryType.java:134)
at org.hibernate.type.NullableType.isEqual(NullableType.java:233)
at org.hibernate.type.MutableType.replace(MutableType.java:60)
at org.hibernate.type.TypeFactory.replace(TypeFactory.java:548)
at org.hibernate.event.def.DefaultMergeEventListener.copyValues(DefaultMergeEventListener.java:495)
at org.hibernate.event.def.DefaultMergeEventListener.entityIsDetached(DefaultMergeEventListener.java:423)
at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:234)
at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:84)
at org.hibernate.impl.SessionImpl.fireMerge(SessionImpl.java:859)
at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:843)
at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:847)
It seems to work fine on session.get()
I think it is a bug.
--
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, 2 months
[Hibernate-JIRA] Created: (HHH-7257) PersistentSet is initialized by criteria query with incomplete data
by Peter Fodor (JIRA)
PersistentSet is initialized by criteria query with incomplete data
-------------------------------------------------------------------
Key: HHH-7257
URL: https://hibernate.onjira.com/browse/HHH-7257
Project: Hibernate ORM
Issue Type: Bug
Components: query-criteria
Affects Versions: 4.1.2, 3.5.5
Environment: Hibernate 4.1.2 and 3.5.5
java version "1.6.0_31"
Java(TM) SE Runtime Environment (build 1.6.0_31-b04)
Java HotSpot(TM) 64-Bit Server VM (build 20.6-b01, mixed mode)
Ubuntu Linux 11.10
PostgreSQL 9.1, HSQLDB 2.2.8
Reporter: Peter Fodor
Attachments: hibernate-criteria-testcase.zip
A criteria query with a filter (to the elements of a one-to-many relation) can initialize the persistent set with so that it returns not all items.
More detailed description:
1a. A bean is a simple entity
1b. A bean has multiple B beans
2. Query A bean with a filter to B
3a. The returns good result in the terms of A
3b. The set of returned A bean (which contains B instances) does not contains every referenced B item
4. After querying A items again with session.get() the returned A instances neither have the full set (with every B reference)
Expected behavior:
1. The Set of A instances should contain every referenced B item. (I know it can not be done with one query in general case)
2. If I query the same items with session.get() it shouldn't be affected by previous query and its set should contain every item. (I think this is the most serious problem)
3. The PersistentSet shouldn't marked with initialized=true, if its content can not be guaranteed that it contains every item.
Note:
The set of the same query is different (and contains every item), if its PersistentSet is initialized in the same session by an other query. (e.g. with a previous session.get().toString())
For more detailed description please check the test case.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 2 months