8 Replies Latest reply on Jan 21, 2005 8:46 AM by Magnus Sandberg

    jboss-5.0.0alpha build

    Grayson Pierce Newbie

      Per previous discussion, if you cvs checkout jboss-head and build it you end up with a jboss-5.0.0alpha build in the output directory. When you try to run the tutorials agains this build, the entity tutorial works just fine (purchase_order, lineitems, etc)

      however if you try to run the composite key tutorial you get the following

      16:01:18,814 ERROR [Ejb3Module] Starting failed jboss.j2ee:service=EJB3,module=t
      utorial.ejb3
      java.lang.TypeNotPresentException: Type javax.ejb.Dependent not present

      How can this be?

        • 1. Re: jboss-5.0.0alpha build
          Bill Burke Master

          how can this be? Well...the @Dependent annotation has changed to @Embedded and I haven't updated(forgot) the tutorial yet.

          Bill

          • 2. Re: jboss-5.0.0alpha build
            Grayson Pierce Newbie

            Bill,

            Thank you for the quick response. This begs the questions, where do you go for the latest ejb 3.0 spec? I specifically checked the one on JBoss and Sun websites before posting.

            • 3. Re: jboss-5.0.0alpha build
              Bill Burke Master

              www.jcp.org

              the ejb3 in CVS is different than the draft you will get at the jcp.org because we are working with a version not yet public.

              Bill

              • 4. Re: jboss-5.0.0alpha build
                Michael Ralston Newbie

                 

                "graysonpierce" wrote:
                Per previous discussion, if you cvs checkout jboss-head and build it you end up with a jboss-5.0.0alpha build in the output directory. When you try to run the tutorials agains this build, the entity tutorial works just fine (purchase_order, lineitems, etc)

                however if you try to run the composite key tutorial you get the following

                16:01:18,814 ERROR [Ejb3Module] Starting failed jboss.j2ee:service=EJB3,module=t
                utorial.ejb3
                java.lang.TypeNotPresentException: Type javax.ejb.Dependent not present

                How can this be?


                I've been looking through the source for ejb3, and noticed that the getIdColumn method of EntityToHibernateXML assumes that the class has a single primary key.

                I made a change to that to check for an EmbeddedId and I got that example to work properly.

                I now have a problem with a project I am working on with EJB3 in that I have an abstract entity which all my other entities extend, but the highest abstract class is the only one with a primary key, and it is a composite key.

                org.hibernate.MappingException: Foreign key (UserBean [pk])) must have same number of columns as the referenced primary key (ItemBean [id,configurationDirectory,suffix])
                at org.hibernate.mapping.ForeignKey.alignColumns(ForeignKey.java:85)
                at org.hibernate.mapping.ForeignKey.setReferencedTable(ForeignKey.java:51)
                at org.hibernate.cfg.Configuration.secondPassCompileForeignKeys(Configuration.java:889)
                at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:837)
                at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:996)
                at org.jboss.ejb3.HibernateSessionFactory.createSessionFactory(HibernateSessionFactory.java:157)
                at org.jboss.ejb3.Ejb3Module.createHibernateSessionFactory(Ejb3Module.java:212)
                at org.jboss.ejb3.Ejb3Module.startService(Ejb3Module.java:224)


                You got any Tips Bill? I'm happy to hack at the code myself...

                • 5. Re: jboss-5.0.0alpha build
                  Bill Burke Master

                  @Inheritance won't work with composite keys yet.

                  http://jira.jboss.com/jira/browse/EJBTHREE-45

                  (just entered in today)

                  Is this your problem? Or are you just doing

                  abstract class Foo
                  {
                  @EmbeddedId MyPK pk;
                  }

                  @Entity
                  public class FooImpl extends Foo
                  {
                  }

                  where Foo is not annotated as @Entity

                  • 6. Re: jboss-5.0.0alpha build
                    Michael Ralston Newbie

                    Nup, I've got Foo as an Entity too...

                    I guess I'll just use an autogenerated primary key and ensure the uniqueness of the other fields manually.

                    • 7. Re: jboss-5.0.0alpha build
                      Bill Burke Master

                      ok this is a bug then and on the TODO list for the release at the end of the month

                      • 8. Re: jboss-5.0.0alpha build
                        Magnus Sandberg Novice

                         

                        "bill.burke@jboss.com" wrote:
                        www.jcp.org

                        the ejb3 in CVS is different than the draft you will get at the jcp.org because we are working with a version not yet public.

                        Bill


                        Is there any ETA for the next public draft?

                        /Magnus