3 Replies Latest reply on Feb 4, 2005 4:33 PM by danch1

    ManyToOne in an Embedded object?

    danch1

      I've got a situation with an embedded object that has as one of its properties a @ManyToOne relationship to an Entity. Under today's CVS, this is being mapped into a bytea (postgresql) rather than the expected bigint foreign key. For reference, here's my Embedded:

      @Embedded({
       @AttributeOverride(name="unit", column=@Column(name="dur_unit")),
       @AttributeOverride(name="magnitude", column=@Column(name="dur_mag", columnDefinition="number(10,2)"))
       })
      public Duration getDuration() {
       return duration;
      }


      The spec I have access to doesn't say anything about this sort of situation, but then it's still talking about DependentObject/Dependent. Looking at AttributeOverride itself, I don't see a clear way to resolve this sort of issue. Is this a hole in the spec, or should the Column be magically interpreted the RightWay by the implementation?

      thanks all,
      danch

        • 1. Re: ManyToOne in an Embedded object?
          bill.burke

          Hey danch, good to see you around again...

          EJB3 is built upon Hibernate. if you look at the ejb3/build-test.xml you'll see a target entity2xml. This takes a set of classes and generates a Hibernate xml.

          Also, did you change Hibernate.properties to use the postgres dialect?

          • 2. Re: ManyToOne in an Embedded object?
            bill.burke

            also, JBoss's ejb3 impl currently ignores columnDefinition. There's still a lot of dotting of the 'i's and crossing of the 't's implementation left to do...

            • 3. Re: ManyToOne in an Embedded object?
              danch1

              You know, I didn't even notice that the column definition wasn't getting picked up. I put that in earlier when I was going against the EJB3 preview release (which wasn't doing anything with my dependents).

              I know hibernate would do what I need quite nicely, I'm looking for a way to tell it to do it through the EJB3 annotations, really. Do you think this sort of situation will be addressed in the spec at some point? Another thing that occurred to me is arrays of dependents (which I believe Hibernate will also do natively, but doesn't seem to be addressed by EJB3)

              thanks,
              danch