-->
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: Repeated column in mapping for entity
PostPosted: Sat Nov 20, 2010 9:56 am 
Newbie

Joined: Thu Oct 07, 2010 10:16 am
Posts: 4
Bonjour,

J'ai un problème :

Repeated column in mapping for entity: com.anathec.business.Dose column: id_product (should be mapped with insert="false" update="false")

Voici mes tables :

Image

Et mon code :

Code:
@Entity
@Table(name = "dose", catalog = "anathec")
public class Dose implements Serializable {

    private DoseId id;
    private Product product;
    private ProductConcentration productConcentration;
    private double dailyProductDose;

    public Dose() {
    }

    @EmbeddedId
    @AttributeOverrides({
       @AttributeOverride(name = "idProduct", column = @Column(name = "id_product", nullable = false)) })
    public DoseId getId() {
   return this.id;
    }

    public void setId(DoseId id) {
   this.id = id;
    }

    @ManyToOne(fetch = FetchType.EAGER)
    @JoinColumn(name = "id_product", nullable = false, insertable = false, updatable = false)
    public Product getProduct() {
   return this.product;
    }

    public void setProduct(Product product) {
   this.product = product;
    }

    @ManyToOne(fetch = FetchType.EAGER)
    @JoinColumns({
       @JoinColumn(name = "id_product", referencedColumnName = "id_product", nullable = false),
       @JoinColumn(name = "id_product_concentration", referencedColumnName = "id_product_concentration", nullable = false) })
    public ProductConcentration getProductConcentration() {
   return this.productConcentration;
    }

    public void setProductConcentration(ProductConcentration productConcentration) {
   this.productConcentration = productConcentration;
    }

    @Column(name = "daily_product_dose", nullable = false, precision = 22, scale = 0)
    public double getDailyProductDose() {
   return this.dailyProductDose;
    }

    public void setDailyProductDose(double dailyProductDose) {
   this.dailyProductDose = dailyProductDose;
    }
}


J'ai un peu simplifier l'objet pour que ce soir plus compréhensible.

Comment faire pour avoir le résultat voulus comme dans le graph?

Merci,


Top
 Profile  
 
 Post subject: private label rights
PostPosted: Sun Nov 28, 2010 5:02 am 
Newbie

Joined: Sun Nov 28, 2010 4:59 am
Posts: 1
check out this site its very helpful...
===============================
private label rights


Top
 Profile  
 
 Post subject: Re: Repeated column in mapping for entity
PostPosted: Tue Dec 14, 2010 7:56 am 
Beginner
Beginner

Joined: Fri May 13, 2005 9:39 am
Posts: 21
Salut,
Sur tes many-to-one, il faut que tu signales à Hibernate qu'il ne doit pas mettre à jour tes références (attributs insert et update).
Lorsque tu effectues des sélections, tes many-to one seront remplis par contre lors des insertions et mises à jour, hibernate ignorera les colonnes qui sont utilisées pour la référence.


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.