-->
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.  [ 2 posts ] 
Author Message
 Post subject: why not one-to-many without join table?
PostPosted: Thu Apr 14, 2005 2:40 pm 
Regular
Regular

Joined: Thu Apr 14, 2005 2:15 pm
Posts: 66
The hibernate documentation says: A unidirectional one-to-many association on a foreign key is a very unusual case, and is not really recommended.
... We think it's better to use a join table for this kind of association.
.
What's the problem in it? Is there any tecnical issue?

My situation: 1 customer have 0 or more budget.
Code:
public class Customer extends Persistente {

   private String nome;
   private List<Orcamento> orcamentos;
   
   public Cliente() {}
   
   public Cliente(String nome) {
      this.nome = nome;
   }

   public String getNome() {
      return nome;
   }
   
   public void setNome(String nome) {
      this.nome = nome;
   }

   public List<Orcamento> getOrcamentos() {
      return orcamentos;   
   }

   public void setOrcamentos(List<Orcamento> orcamentos) {
      this.orcamentos = orcamentos;
   }
   
}
public abstract class Persistente {

    protected int id;

    public int getId() {
        return id;
    }

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


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 03, 2005 8:34 am 
Beginner
Beginner

Joined: Thu Dec 23, 2004 8:47 am
Posts: 32
Location: Brazil State:Rio Grande do Sul City:Porto Alegre
I have the same doubt!
Why it´s not recommended?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.