[Hibernate-JIRA] Created: (HHH-2466) cglib proxy doesn't ensure java identity within a session
by Stephen Haberman (JIRA)
cglib proxy doesn't ensure java identity within a session
---------------------------------------------------------
Key: HHH-2466
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2466
Project: Hibernate3
Type: Bug
Components: core
Versions: 3.2.2
Reporter: Stephen Haberman
Because CGLIBLazyInitializer uses composition instead of inheritance, there are two object instances (one for the proxy, one for the real instance) for the same row in the same session. Documentation section 4.3 says otherwise, but it is wrong.
Example:
fooProxy = ...getFoo() returns a Foo proxy...
bar = fooProxy.makeNewBar()
// makeNewBar() = { bar = new Bar(); bar.setFoo(this); return bar }
fooClean = bar.getFoo()
assert fooProxy == fooClean // fails
When "makeNewBar" does "setFoo" the parameter "this" is the non-proxied Foo instance. We have effectively leaked the non-proxied instance.
CGLIBLazyInitializer:155 contains a cute hack to try to avoid this--if "makeNewBar()" returns the non-proxied Foo instance, it switches out and returns the Foo proxy instead. However, this only solves the trivial case where the instance method returns the instance itself.
Basically this means equals/hashCode have to be implemented all the time because the "hibernate ensures java identity within a session" assertion is wrong.
The best fix seems like changing the cglib proxy to not proxy to a separate instance but to proxy to its parent class. That way when "bar.setFoo(this)" was called, "this" would still be the proxy. And then there really would be "1 instance per database row".
--
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
18 years
[Hibernate-JIRA] Created: (HHH-2465) stateless session with custom identifier generator null get after insert
by Luca Dall'Olio (JIRA)
stateless session with custom identifier generator null get after insert
------------------------------------------------------------------------
Key: HHH-2465
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2465
Project: Hibernate3
Type: Bug
Versions: 3.2.1
Environment: hibernate 3.2.1 ga hsqldb 1.8.0.1
Reporter: Luca Dall'Olio
Attachments: statelesssessioncustomgenerator.zip
In a stateless session, defining a custom identifier generator, if a session.get() is done after a session.insert() in the same transaction, session.get() returns null.
Looks like insert was never done (but it is logged).
I have tried to adapt the test/sessionless distributed with hibernate (attached)
Example of test failing :
public void testInitId() {
StatelessSession ss = getSessions().openStatelessSession();
Transaction tx = ss.beginTransaction();
Paper paper = new Paper();
paper.setColor( "White" );
ss.insert(paper);
assertNotNull( paper.getId() );
ss.delete( ss.get( Paper.class, paper.getId() ) );
tx.commit();
ss.close();
}
(same test with a commit between ss.insert() and ss.get() is green)
(same test without a custom identifier generator is green)
here is a snippet of the mapping file :
<class name="Paper">
<id name="id"><generator class="org.hibernate.test.stateless.CustomSequenceIdentifierGenerator" /></id>
<property name="color"/>
</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
18 years
[Hibernate-JIRA] Created: (HHH-2462) byte[] column type causes syntax error in PostgreSQL 8.2.3
by Al Sutton (JIRA)
byte[] column type causes syntax error in PostgreSQL 8.2.3
----------------------------------------------------------
Key: HHH-2462
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2462
Project: Hibernate3
Type: Bug
Components: core
Versions: 3.2.2
Environment: Windows XP SP2
PostgreSQL 8.2.3
Hibernate 3.2.2
Hibernate Annotations 3.2.1
Reporter: Al Sutton
We have an object which has one property defined as a byte array. We're using <property name="hibernate.hbm2ddl.auto">update</property> in the hibernate mapping file to automatically create the schema.
When we create the first hibernate session we get;
02-Mar-2007 12:56:49 org.hibernate.tool.hbm2ddl.SchemaUpdate execute
SEVERE: Unsuccessful: create table RegisteredUser (id bigint not null, username varchar(255), disabled smallint not null, emailAddress varchar(255), encryptedPassword varchar(255) for bit data, lastLogin bigint, searchCredits integer not null, privs bigint not null, person_fk bigint, primary key (id))
02-Mar-2007 12:56:49 org.hibernate.tool.hbm2ddl.SchemaUpdate execute
SEVERE: ERROR: syntax error at or near "for"
resulting in the table not being created, and thus the application does not work.
This appears to go against the Hibernate claim of POJO persistance.
--
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
18 years
[Hibernate-JIRA] Created: (HHH-2461) Query can't handle selecting the result of comparison operators
by tomas (JIRA)
Query can't handle selecting the result of comparison operators
---------------------------------------------------------------
Key: HHH-2461
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2461
Project: Hibernate3
Type: Bug
Components: query-hql
Versions: 3.2.2
Environment: Mysql, java 1.5
Reporter: tomas
The following query would run in mysql:
select ( 1 < 2 )
from MyTable t;
but gives the following error when I use the Query( not the SQL Query ):
09:21:52,218 ERROR PARSER: <AST>:1:10: unexpected AST node: <
org.hibernate.hql.ast.QuerySyntaxException: unexpected AST node: < near line 1, column 10 [select 1 < 2 from com.myCompany.MyTable t ]
at org.hibernate.hql.ast.QuerySyntaxException.convert(QuerySyntaxException.java:31)
at org.hibernate.hql.ast.QuerySyntaxException.convert(QuerySyntaxException.java:24)
at org.hibernate.hql.ast.ErrorCounter.throwQueryException(ErrorCounter.java:59)
at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:235)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:160)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:111)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:77)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:56)
at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:72)
at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:133)
at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:112)
at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1623)
Thanks a lot
--
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
18 years
[Hibernate-JIRA] Created: (ANN-568) Class cast exception in org.hibernate.search.impl.FullTextSessionImpl<init>(FullTextSessionImpl.java:54)
by Adrian Pillinger (JIRA)
Class cast exception in org.hibernate.search.impl.FullTextSessionImpl<init>(FullTextSessionImpl.java:54)
--------------------------------------------------------------------------------------------------------
Key: ANN-568
URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-568
Project: Hibernate Annotations
Type: Bug
Versions: 3.2.1
Environment: JBoss 5.0.0 Beta1, Hibernate 3.2.2 GA, Hibernate Annotations 3.2.1 GA, Hibernate Entity Manager 3.2.1 GA
Reporter: Adrian Pillinger
Priority: Critical
This issue is also documented in the following thread, but no-one has replied to the original author.
http://forum.hibernate.org/viewtopic.php?t=968907&highlight=fulltextsessi...
The following class cast exception occurs inside org.hibernate.search.impl.FullTextSessionImpl.
java.lang.ClassCastException: org.jboss.ejb3.entity.TransactionScopedHibernateSession incompatible with org.hibernate.impl.SessionImpl
at org.hibernate.search.impl.FullTextSessionImpl.<init>(FullTextSessionImpl.java:54)
at org.hibernate.search.Search.createFullTextSession(Search.java:17)
This happens because FullTextSessionImpl's constructor is casting the org.hibernate.Session interface passed as an argument to the constructor to org.hibernate.impl.SessionImpl. Of course the jboss class TransactionScopedHibernateSession is not an instance of SessionImpl.
public class FullTextSessionImpl implements FullTextSession {
private final SessionImpl session;
private PostTransactionWorkQueueSynchronization postTransactionWorkQueueSynch;
public FullTextSessionImpl(Session session) {
this.session = (SessionImpl) session;
}
...
Also, the method createFullTextQuery constructs an instance of FullTextQueryImpl with the session that the FullTextSessionImpl was instantiated with. The FullTextQueryImpl constructor expects to receive an instance of org.hibernate.engine.SessionImplementor. TransactionScopedHibernateSession and the interface org.hibernate.Session do not implement this interface.
The following link is an issue in jira for JBoss EJB 3 about the fact it doesn't support SessionImplementor. Though I don't know if JBoss should implement this interface or not - it may well be bad design for JBoss to implement this just to get it working and perhaps some hibernate refactoring is needed to sort these issues out instead.
http://jira.jboss.com/jira/browse/EJBTHREE-714
FYI the class definition of TransactionScopedHibernateSession is as follows...
public class TransactionScopedHibernateSession implements Session, Externalizable
{
...
}
This is critical since the search functionality in 3.2.1GA of annotations cannot be used in JBoss as the Session is proxied by TransactionScopedHibernateSession.
--
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
18 years
[Hibernate-JIRA] Moved: (HSEARCH-25) Class cast exception in org.hibernate.search.impl.FullTextSessionImpl<init>(FullTextSessionImpl.java:54)
by Emmanuel Bernard (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-25?page... ]
Emmanuel Bernard moved ANN-568 to HSEARCH-25:
---------------------------------------------
Version: (was: 3.2.1)
HAN-3.2.1 (Previous Bundled)
Key: HSEARCH-25 (was: ANN-568)
Project: Hibernate Search (was: Hibernate Annotations)
> Class cast exception in org.hibernate.search.impl.FullTextSessionImpl<init>(FullTextSessionImpl.java:54)
> --------------------------------------------------------------------------------------------------------
>
> Key: HSEARCH-25
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-25
> Project: Hibernate Search
> Type: Bug
> Versions: HAN-3.2.1 (Previous Bundled)
> Environment: JBoss 5.0.0 Beta1, Hibernate 3.2.2 GA, Hibernate Annotations 3.2.1 GA, Hibernate Entity Manager 3.2.1 GA
> Reporter: Adrian Pillinger
> Priority: Critical
>
>
> This issue is also documented in the following thread, but no-one has replied to the original author.
> http://forum.hibernate.org/viewtopic.php?t=968907&highlight=fulltextsessi...
> The following class cast exception occurs inside org.hibernate.search.impl.FullTextSessionImpl.
> java.lang.ClassCastException: org.jboss.ejb3.entity.TransactionScopedHibernateSession incompatible with org.hibernate.impl.SessionImpl
> at org.hibernate.search.impl.FullTextSessionImpl.<init>(FullTextSessionImpl.java:54)
> at org.hibernate.search.Search.createFullTextSession(Search.java:17)
> This happens because FullTextSessionImpl's constructor is casting the org.hibernate.Session interface passed as an argument to the constructor to org.hibernate.impl.SessionImpl. Of course the jboss class TransactionScopedHibernateSession is not an instance of SessionImpl.
> public class FullTextSessionImpl implements FullTextSession {
> private final SessionImpl session;
> private PostTransactionWorkQueueSynchronization postTransactionWorkQueueSynch;
> public FullTextSessionImpl(Session session) {
> this.session = (SessionImpl) session;
> }
> ...
> Also, the method createFullTextQuery constructs an instance of FullTextQueryImpl with the session that the FullTextSessionImpl was instantiated with. The FullTextQueryImpl constructor expects to receive an instance of org.hibernate.engine.SessionImplementor. TransactionScopedHibernateSession and the interface org.hibernate.Session do not implement this interface.
> The following link is an issue in jira for JBoss EJB 3 about the fact it doesn't support SessionImplementor. Though I don't know if JBoss should implement this interface or not - it may well be bad design for JBoss to implement this just to get it working and perhaps some hibernate refactoring is needed to sort these issues out instead.
> http://jira.jboss.com/jira/browse/EJBTHREE-714
> FYI the class definition of TransactionScopedHibernateSession is as follows...
> public class TransactionScopedHibernateSession implements Session, Externalizable
> {
> ...
> }
> This is critical since the search functionality in 3.2.1GA of annotations cannot be used in JBoss as the Session is proxied by TransactionScopedHibernateSession.
--
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
18 years