-
1. Re: @EmbeddableSuperclass
mduffy_lists Aug 18, 2005 4:18 AM (in response to mduffy_lists)EJB QL does not work for fields in the EmbeddableSuperclass. :(
Mike -
2. Re: @EmbeddableSuperclass
mduffy_lists Aug 18, 2005 11:58 AM (in response to mduffy_lists)There are two problems here:
First, the fields in the superclass are not being updated.
Second, if you create an EJB QL query based on fields in the superclass, you get an exception:
03:36:55,616 WARN [RequestProcessor] Unhandled Exception thrown: class javax.ejb.EJBException
03:36:55,619 ERROR [[action]] Servlet.service() for servlet action threw exception
javax.ejb.EJBException: null; CausedByException is:
could not resolve property: created of: com.forbintechnologies.tracker.entitymodel.IssueDisplayItem [SELECT i FROM com.forbintechnologies.tracker.entitymodel.IssueDisplayItem i WHERE i.created > :created ]
at org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:46)
at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:70)
at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:134)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:88)
at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:72) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:88)
at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:39)
Thx.
Mike -
3. Re: @EmbeddableSuperclass
epbernard Aug 18, 2005 9:24 PM (in response to mduffy_lists)Are you *sure*? If this is true, submit a minimal working testcase, I'll look at it.
-
4. Re: @EmbeddableSuperclass
mduffy_lists Sep 2, 2005 10:50 PM (in response to mduffy_lists)I have a test case, where shoould I send it?
The columns represented in the superclass are not being persisted.
In the simple test, the superclass contains two parameters, "updated" and "createdTest" (both Timestamps).
The database table also contains a column for "created". Initiially, I could not figure out why the column for "created" was being persisted but the column for "updated" was not being persisted, so I created a column called "createdTest". Interestingly, the database value for "created" is persisted, eventhough "created" is not a parameter in the entity bean (this behavior is not defined in the spec).
Also if you attempt to do a querry based on a parameter in the superclass, an exception is thrown:
javax.ejb.EJBException: null; CausedByException is:
could not resolve property: createdTest of: com.test.TestEmbeddableSub [SELECT te FROM com.test.TestEmbeddableSub te WHERE te.createdTest < :created ]
at org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:46)
at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:70)
at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:134)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:88)
at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:72) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:88)
The spec does state, "An embeddable superclass, unlike an entity, is not queryable.....". Does this mean that the parameters of the superclass cannot be used in a query? If this is so, it seems like a significant limitation. I think it should mean that you can't do a query and get an object back that is an instance of the embeddable superclass.
What I'd like to be able to do is create a superclass that has the basic fields that are contained in all my tables (created, updated, updatedby, datasource, etc.). BTW: This worked in the very early preview releases. :)
Mike -
5. Re: @EmbeddableSuperclass
epbernard Sep 8, 2005 12:02 PM (in response to mduffy_lists)If you really have this test case post it here http://opensource.atlassian.com/projects/hibernate/secure/Dashboard.jspa
But be very sure, 'cause I do have a working test case myself -
6. Re: @EmbeddableSuperclass
mduffy_lists Sep 8, 2005 12:40 PM (in response to mduffy_lists)Could you please send me your test case and I'll double check before I post mine.
mduffy_lists@yahoo.com
Thx.
Mike -
7. Re: @EmbeddableSuperclass
epbernard Sep 9, 2005 5:13 AM (in response to mduffy_lists)Everything is online
http://cvs.sourceforge.net/viewcvs.py/hibernate/HibernateExt/metadata/src/test/org/hibernate/test/annotations/inheritance/SubclassTest.java?rev=1.7&view=auto
testEmbeddedSuperclass
http://cvs.sourceforge.net/viewcvs.py/hibernate/HibernateExt/metadata/src/test/org/hibernate/test/annotations/embedded/EmbeddedTest.java?rev=1.6&view=auto
testEmbeddedSuperclass
http://cvs.sourceforge.net/viewcvs.py/hibernate/HibernateExt/metadata/src/test/org/hibernate/test/annotations/id/IdTest.java?rev=1.6&view=auto
testIdInEmbeddableSuperclass -
8. Re: @EmbeddableSuperclass
mduffy_lists Sep 11, 2005 7:51 PM (in response to mduffy_lists)The test
http://cvs.sourceforge.net/viewcvs.py/hibernate/HibernateExt/metadata/src/test/org/hibernate/test/annotations/id/IdTest.java?rev=1.6&view=auto
testIdInEmbeddableSuperclass
only checkes that the object is persisted.
What I am saying is that if you have multiple fields in the embeddable superclass, those fields are not all persisted, and even if the data is already in the db, you cannot search on those fields.
Also, are there guidelines for writing test cases for the JBoss EJB3 framework?
Mike -
9. Re: @EmbeddableSuperclass
mduffy_lists Sep 18, 2005 1:02 PM (in response to mduffy_lists)Has anyone got this to work?
What I am saying is that if you have multiple fields in the embeddable superclass, those fields are not all persisted, and even if the data is already in the db, you cannot search on those fields.
For example, try putting "datasourceTypeCode" and "updatedById" in your embeddable superclass.
The JBoss test case only checks for persistence of the class, not persistence of specific fields or the ability to search on specific fields.
Mike -
10. Re: @EmbeddableSuperclass
epbernard Sep 19, 2005 5:37 AM (in response to mduffy_lists)Check the Hibernate Annotation test suite. I also have a o.h.test.annotations.FlyingObject which contains properties accessible and loaded from the DB.
-
11. Re: @EmbeddableSuperclass
mduffy_lists Sep 20, 2005 12:25 AM (in response to mduffy_lists)Thx Emmanuel for your patience.
I see the class "o.h.test.annotations.FlyingObject", and it is an @EmbeddableSuperclass.
Could you please tell me which test case uses this class?
Mike
PS. IS it correct that there is no capability to search SourceForge CVS through the web interface? -
12. Re: @EmbeddableSuperclass
epbernard Sep 21, 2005 6:02 AM (in response to mduffy_lists)o.h.t.a.inheritance.SubclassTest
o.h.t.a.query.QueryTest //not sure it's related though