Impossible to generate db table for an entity with 2 instances of an embedded class

Marc
2013-08-04
2013-08-06
  • Marc

    Marc - 2013-08-04

    Hi,
    I have the following situation:

    A customer has 2 addresses: an invoice address and a shipping address.
    The entity Customer has 2 embedded addresses.
    The problem however is that for the second address, no database fields are generated. I am using automatic database generation from within eclipse (I run ant with update schema).
    When I drop the shipping address and only keep the invoice address, everything works fine. But with the shipping address, I get errors and I observe the database has not been generated properly.
    Can I work around this somehow?
    Thanks,
    Marc

     
  • Javier Paniza

    Javier Paniza - 2013-08-06

    Hi Marc,

    use @AttributeOverride for one of your embedded:

    @Embedded
    @AttributeOverrides({
        @AttributeOverride(name="startDate",
            column=@Column(name="EMP_START")),
        @AttributeOverride(name="endDate",
            column=@Column(name="EMP_END"))
    })
    public EmploymentPeriod getEmploymentPeriod() { ... }
    

    Have a look at the section 11.1.14 of the JPA2 specification.


    Help others in this forum as I help you.
    Need more help? Get OpenXava professional support.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks