[jboss-user] [EJB 3.0] - Strange mapping problem...

taprogge do-not-reply at jboss.com
Mon Aug 14 08:04:19 EDT 2006


Hello all!

I have here a strange mapping problem on my hands (at least it seems strange to me). Perhaps anyone here can enlighten me.

I have an entity model that contains (among other things) two entities (Cheque and BonusCard) that work perfectly by themselves. 
Cheque is an obstract class with InheritenceStrategy.JOINED, BonusCard is the only class in it's hirarchy.
I now would like them to extend a common superclass, again JOINED.

When I do this, suddenly hibernate complains like this on a field on the BonusCard:


  | org.hibernate.MappingException: Could not determine type for: java.util.List, for columns: [org.hibernate.mapping.Column(accountList)]
  | 

Since I have no idea where my mistake might lie, I will post the classes here.
Any hints are very much appreciated.

This is the intended superclass:

  | @Entity
  | @Table(name = "VOUCHER")
  | @Inheritance(strategy = InheritanceType.JOINED)
  | public abstract class Voucher implements Serializable {
  | 
  | 	@Id
  | 	@Column(name = "ID")
  | 	private long id;
  | 
  | 	@Column(name = "BARCODE")
  | 	@NotNull
  | 	private String barcode;
  | 
  | 	@Version
  | 	@Column(name = "CNT_VERSION")
  |         private long versionCounter;
  | 
  | 	@NotNull
  | 	@ManyToOne
  | 	@JoinColumn(name = "CHARGE")
  | 	private Charge charge;
  | 
  | [... getters and setters ...]
  | }
  | 

This is the Cheque class:

  | @Entity
  | @Table(name = "CHEQUE")
  | @Inheritance(strategy = InheritanceType.JOINED)
  | public abstract class Cheque extends Voucher implements Serializable {
  | 	
  |     @NotNull
  |     @ManyToOne(optional = false)
  |     @JoinColumn(name = "CHEQUE_STATUS")
  |     private ChequeStatus chequeStatus;
  | 
  |     @ManyToOne
  |     @JoinColumn(name = "CUSTOMER")
  |     private Customer customer;
  | 
  |     @NotNull
  |     private Date expires;
  | 
  |     @ManyToOne
  |     @JoinColumn(name = "ACQUIRER")
  |     private Acquirer redeemingAcquirer;
  | 
  | [... getters and setters ...]
  | }
  | 

This is the BonusCard class:

  | @Entity
  | @Table(name = "BONUSCARD")
  | @Inheritance(strategy = InheritanceType.JOINED)
  | public class BonusCard extends Voucher implements Serializable {
  | 
  |     @ManyToMany
  |     private List<CustomerUser> distributeUsers;
  | 
  |     @ManyToOne(optional = false)
  |     private CustomerUser managingUser;
  | 
  |     @ManyToOne
  |     private User user;
  | 
  |     @ManyToOne(optional = false)
  |     private BonusCardStatus bonusCardStatus;    
  | 
  |     @OneToMany(mappedBy = "bonusCard", cascade = (CascadeType.ALL)) 
  |     private List<CardAccount> accountList;
  | 
  |     @NotNull
  |     @Column(name = "EXPIRES")
  |     private Date expires;
  | 
  | [... getters and setters ...]
  | }
  | 


And finally the Charge I want them both to be associated with:


  | @Entity
  | @Table(name = "CHARGE")
  | public class Charge implements Serializable {
  | 
  | 	@Id
  | 	@NotNull
  | 	@Column(name = "ID_CHARGE")
  | 	private int chargeId;
  | 	
  | 	@OneToMany(mappedBy = "charge")
  | 	private List<Voucher> vouchers;
  | 	
  | 	@ManyToOne
  | 	private Customer customer;
  | 	
  | 	@ManyToOne(optional = false)
  | 	private ChargeStatus status;
  | 	
  | 	@ManyToOne
  | 	@JoinColumn(name = "ACQUIRERGROUP")
  | 	private AcquirerGroup acquirerGroup;
  | 	
  | [... getters and setters ...]
  | }
  | 

Thanks in advance for any advice you might have.

Regards,
Phil

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3964941#3964941

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3964941



More information about the jboss-user mailing list