7 Replies Latest reply on Jul 23, 2005 8:36 PM by epbernard

    Why ? ...

    any_key

      Why @EmbeddableSuperclass doesn't works without @Entity annotation ??? This leads to creation of an empty table in DB.

      @Entity(access = AccessType.FIELD)
      // from now we MUST specify @Id field and SUPERCLASS table will be created
      @EmbeddableSuperclass
      public abstract class SuperClass {

      @Id(generate = GeneratorType.TABLE)
      @Column(name = "ID") // mapped in empty SUPERCLASS table
      private int id = -1;

      @Column(name = "SOME_VALUE") // mapped in empty SUPERCLASS table
      private String someValue = null;

      // Constructors, Get & Set methods here
      // ...
      }

      @Entity(access = AccessType.FIELD)
      public class ChildClass extends SuperClass {

      // ID and SOME_VALUE are inherited and REmapped in CHILDCLASS table

      @Column(name = "ANOTHER_VALUE") // also mapped in CHILDCLASS table
      private String anotherValue = null;

      // Constructors, Get & Set methods here
      // ...
      }

      All this situation isn't correct. If You have a look at chapter 2.1.9.3 of JSR220 Java Persistence API (Public Draft) You will see a very good example of CORRECT use of @EmbeddableSuperclass which doesn't work in JBoss + EJB3 Beta1.

      It's a BUG ???

      Thanks.

        • 1. Re: Why ? ...
          epbernard

          @embeddedSuperclass should not be used in conjunction with @Entity.
          The whole issue is that you have to explicitly declare the @EmbeddedSuperclasses in your persistence.xml for this release
          This is now fixed in hibernate anntations.

          • 2. Re: Why ? ...
            any_key

             

            "epbernard" wrote:
            @embeddedSuperclass should not be used in conjunction with @Entity.
            The whole issue is that you have to explicitly declare the @EmbeddedSuperclasses in your persistence.xml for this release
            This is now fixed in hibernate anntations.


            Thanks !!!

            • 3. Re: Why ? ...
              any_key

               

              "epbernard" wrote:
              @embeddedSuperclass should not be used in conjunction with @Entity.
              The whole issue is that you have to explicitly declare the @EmbeddedSuperclasses in your persistence.xml for this release
              This is now fixed in hibernate anntations.


              What tag I should use in persistence.xml for definition of @EmbeddableSuperclass? <c1ass> does not work.

              <c1ass>platform.data.AuditableEntity</c1ass>

              PS: 1(Number One) is used in examples above instead of letter 'L' because tag CLASS is reserved in HTML.


              • 4. Re: Why ? ...
                gamac

                Hi!

                Did you manage to workaround this issue?

                I'm having this problem too, and the class tag dosen't work either!

                Thanks for any help.

                • 5. Re: Why ? ...
                  epbernard

                  I'm sorry guys, this is probably a bug in the JBoss EJB3 parsing. You should use an hibernate.cfg.xml while waiting for the next release.

                  • 6. Re: Why ? ...
                    shmendrick

                    Shouldn't this issue be posted in the JIRA?

                    • 7. Re: Why ? ...
                      epbernard