#139 @Tab doesn't work with @AttributeOverride


In OpenXava 3.1.4, SQL queries generated by JDBCTabProvider do not have the correct column name when @AttributeOverride is used. I have done a little debugging, and the 'fields' String[] in JDBCTabProvider has the incorrect values.

In my scenario, I need to use @AttributeOverride because I am using @Embedded for my Address implementation and I have some entities with multiple addresses (e.g. billing address and shipping address). In that case, Hibernate requires that at least one set of columns needs to use @AttributeOverride to prevent duplicate column names in the generated table DDL.

Javier suggested "There is no test using @AttributeOverride in OpenXavaTest so surely it's a bug."


  • Federico Alcantara

    Hi Roy,

    Can you put here a simple test case for this behaviour?


  • Roy Hellinga

    Roy Hellinga - 2010-10-06

    I think this is the test case for this bug (although I'm not certain of it -- it has been a while and my original code is changed). My real application's Address class is more complicated than this (with associations to Province and Country entities), this test application is simpler:

    First, an @Embeddable class:

    public class Address {
    private String addrStreetAddress;
    private String addrCity;
    private String addrState;
    private String addrPostCode;

    Second, an entity that calls embeds that class at least twice:

    public class Customer {
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(length = 8)
    private int custId;
    private String custName;
    private Address custShipToAddr;
    private Address custBillToAddr;

    For me this generates the following error in the log:
    "Mapping not found for custBillToAddr_addrStreetAddress in Customer". I'm not certain this is the original error, since my bug report speaks of invalid SQL being generated, and this isn't getting that far. In any case, this example provides the structure of what OX needs to support.

  • Javier Paniza

    Javier Paniza - 2011-07-07
    • milestone: --> v4.2.1
    • status: open --> closed-fixed

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

Sign up for the SourceForge newsletter:

No, thanks