Incorrect HBM mappings when using mapped superclass in inheritance graphics for ColdFusion 9.0.1. Fix 2

Let's say I have an inheritance graph where the base class extends the mapped superclass:

component name="Entity" mappedSuperClass="true"
{
    property name="CreatedOn";
}

component name="Pet" extends="Entity" table="Pet" discriminatorcolumn="pet_type"
{
    property name="PetId" fieldtype="id" generator="native";
    property name="Name";
}

component name="Dog" extends="Pet" table="Pet" discriminatorvalue="Dog"
{
    property name="FavoriteFood";
}

component name="Cat" extends="Pet" table="Pet" discriminatorvalue="Cat"
{
    property name="FavoriteSleepingSpot";
}

      

In this case, I have a base class Pet

with two subclasses Dog

and Cat

. Pet

also extends Entity

to provide some auditing properties.

In ColdFusion 9.0.1 and ColdFusion 9.0.1 Hotfix 1, these components display correctly. I tested it by dropping the HBM mapping. However, in ColdFusion 9.0.1 HotFix 2, the mappings are incorrect. For example, the display Cat

should be:

<hibernate-mapping>
    <subclass discriminator-value="Cat"
        entity-name="Cat" extends="cfc:model.Pet"
        lazy="true" name="cfc:model.Cat">
        <property name="FavoriteSleepingSpot" type="string">
            <column name="FAVORITE_SLEEPING_SPOT"/>
        </property>
    </subclass>
</hibernate-mapping>

      

But what is actually generated is the following:

<hibernate-mapping>
    <subclass discriminator-value="Cat"
        entity-name="Cat" extends="cfc:model.Pet"
        lazy="true" name="cfc:model.Cat">
        <property name="FavoriteSleepingSpot" type="string">
            <column name="FAVORITE_SLEEPING_SPOT"/>
        </property>
        <property name="CreatedOn" type="timestamp">
            <column name="CREATED_ON"/>
        </property>
    </subclass>
</hibernate-mapping>

      

In other words, subclassing includes CreatedOn

in the class Entity

when it shouldn't, and this understandably results in the following error:

Duplicate column in mapping for object: Cat column: CREATED_ON (must be mapped to insert = "false" update = "false")

My question is , is there something wrong with how my entities are declared? Or have I stumbled upon a bug in Hotfix 2 ? If so, what would be the fix for him?

The workaround I'm currently using is to dump the HBM files and edit them manually to remove the duplicate property mapping. This works fine, but I have to repeat this process every time the entities change. Unfortunately we cannot go back to fix 1 either because we need some fixes in Hotfix 2.

+2
coldfusion orm hibernate hibernate-mapping coldfusion-9


source to share


No one has answered this question yet

See similar questions:

3
ColdFusion ORM mappedSuperClass.hbmxml has too many fields

or similar:

3
ColdFusion 9.0.1 Hotfixes
2
How do I map many collections of value types to a single table in Hibernate?
2
Hibernate Validator does not validate proxy subclass constraints
2
Why does ColdFusion / Hibernate add entity name as a prefix for column names in generated SQL?
1
mixing and unidirectional inheritance and query for all objects
1
hibernate hierarchy: NULL is not allowed for discriminator column
1
Hibernate WrongClassException for custom discriminators
1
Coldfusion ORM 9.0.1 - Error Resolving Relationships
0
Hibernate Envers generates wrong value for discriminator value in case of attached inheritance using discriminator column
0
Hibernation inheritance mapping notation with SINGLE_TABLE inheritance type and discriminator column from another table



All Articles
Loading...
X
Show
Funny
Dev
Pics