-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Inheritance mapping gives PropertyAccessException
PostPosted: Fri Jun 04, 2010 9:08 pm 
Newbie

Joined: Fri Jun 04, 2010 8:57 pm
Posts: 19
I was trying to use "Table per subclass" to map my three entities. These entities are
BillingDetails - Base class
CreditCardBilling - derived from BillingDetails
BankAccountBilling - derived from BillingDetails

I am getting the following exception

java.lang.ExceptionInInitializerError
Caused by: org.hibernate.PropertyAccessException: IllegalArgumentException occurred calling getter of com.ns.model.BillingDetails.id
Caused by: java.lang.IllegalArgumentException: object is not an instance of declaring class

Here is BillingDetails
Code:
public abstract class BillingDetails {
    private Long id;
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }


Here is the mapping file
Code:
<hibernate-mapping package="com.ns.model">
    <class
        name="BillingDetails"
        abstract="true"
        table="BILLING_DETAILS">
        <id name="id"
            column="BILLING_DETAILS_ID" type="long">
            <generator class="native"/>
        </id>
        <property name="ownerName" column="OWNER" type="string"/>

        <joined-subclass name="CreditCardBilling" table="CREDIT_CARD_BILLING">
            <key column="CREDIT_CARD_NO"/>
            <property name="expMonth" column="EXP_MONTH"/>
            <property name="expYear" column="EXP_YEAR"/>
        </joined-subclass>

        <joined-subclass name="BankAccountBilling" table="BANK_ACCOUNT_BILLING">
            <key column="ACCOUNT_NO"/>
            <property name="bankName" column="BANK_NAME"/>
        </joined-subclass>

    </class>
</hibernate-mapping>


Any ideas why I am getting the IllegalArgumentException

regards,
Nirvan


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.