-->
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: mapping Interface
PostPosted: Wed Nov 18, 2009 6:50 am 
Beginner
Beginner

Joined: Mon Dec 17, 2007 11:08 pm
Posts: 47
hi,

I wanna mapping interface to hbm.xml file. (sorry I i repeat this post, i really find not answer)

I had a interface Payment, which class CreditCard and class Cash is implements.

my code mapping file like this


Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
        "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
        "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping >
   
    <class name="Payment" abstract="true">
       <id name="id" column="id" >
            <generator class="native"/>
        </id>
       
        <discriminator column="Payment_type" type="string"/>
       
        <subclass
           name="CreditCardPayment" discriminator-value="CreditCard">
           <property name="number" />
           <property name="amount" />
           <property name="expireDate" />
           <property name="BankCode" />
           <property name="creditCardType" />
       </subclass> 
       
       <subclass
           name="CashPayment" discriminator-value="Cash">
           <property name="amount" />
       </subclass>     
              
    </class>
   
</hibernate-mapping>



but it give an exception : field [id] not found on Payment

after many search on google, still canot find a answer/solution.

my question is :
1) can hibernate mapping interface directly ?
2) since interface can't cannot instantiate, hence no [id] can declare in interface, I wondering can we make the [id] exclusive withouth setter and getter in interface Payment ?

any idea ?

kiwi

_________________
happy hacking !


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.