-->
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.  [ 3 posts ] 
Author Message
 Post subject: EJB3 Component Problem
PostPosted: Wed Aug 10, 2005 1:24 pm 
Regular
Regular

Joined: Tue Mar 01, 2005 2:35 pm
Posts: 60
Here's my Address:
Code:
@Embeddable(access = AccessType.FIELD)
public class Address implements Serializable, Comparable<Address> {
   
   private String name;
   
   private String line1;
   
   private String line2;
   
   private String city;
   
   @ManyToOne
   private State state;
   
   private String zipCode;
        /* ... */
}


and here's how I'm trying to use it as a component:

Code:
@Entity(access = AccessType.FIELD)
public class Order implements Serializable, Comparable<Order> {
   
   @Id(generate = GeneratorType.AUTO)
    private Integer id;
   
    @Embedded
    @AttributeOverrides({
        @AttributeOverride(name="name", column = @Column(name="shipToName")),
        @AttributeOverride(name="line1", column = @Column(name="shipToLine1")),
        @AttributeOverride(name="line2", column = @Column(name="shipToLine2")),
        @AttributeOverride(name="city", column = @Column(name="shipToCity")),
        @AttributeOverride(name="state", column = @Column(name="shipToState_id")),
        @AttributeOverride(name="zipCode", column = @Column(name="shipToZipCode")),
    })
    private Address shipTo;
   
    @Embedded
    @AttributeOverrides({
        @AttributeOverride(name="name", column = @Column(name="billToName")),
        @AttributeOverride(name="line1", column = @Column(name="billToLine1")),
        @AttributeOverride(name="line2", column = @Column(name="billToLine2")),
        @AttributeOverride(name="city", column = @Column(name="billToCity")),
        @AttributeOverride(name="state", column = @Column(name="billToState_id")),
        @AttributeOverride(name="zipCode", column = @Column(name="billToZipCode")),
    })
    private Address billTo;

   /* ... */
}


and here's the error that I'm getting:

Code:
Repeated column in mapping for entity: Order column: state_id (should be mapped with insert="false" update="false")


It looks to me like I'm overriding the "state" column, so why is it being mapped twice? Thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 10, 2005 1:56 pm 
Beginner
Beginner

Joined: Thu Mar 31, 2005 9:58 pm
Posts: 25
Location: Valparaiso
I think the shipTo.state and the billTo.state are trying to map de relationship with adress.state with the same name, i.e, hibernate is ignorating your name overrides.

Try something like this:


..... , column = @Column("shipToName")


instead,

...., column = @Column(name="shipToName")


Good luck!

_________________
Daniel Casanueva R.

Jcode
Valparaiso, Chile


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 10, 2005 3:51 pm 
Regular
Regular

Joined: Tue Mar 01, 2005 2:35 pm
Posts: 60
Oops, looks like I put this is the wrong forum. Could a mod move it for me?


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

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.