-->
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: @OneToOne + FetchType.LAZY
PostPosted: Sun Jul 23, 2006 5:15 pm 
Contributor
Contributor

Joined: Wed Jun 28, 2006 2:00 pm
Posts: 3
Location: São Leopoldo, RS
With annotation OneToOne, Hibernate is ignoring FetchType.LAZY

Code:
@Entity
@Table(name = "estudante", schema = "ingres", uniqueConstraints = {})
public class Estudante implements java.io.Serializable {

private Integer cdEstudante;
private EstEnderecoPais estEnderecoPais;

// Property accessors
@Id
@Column(name = "cd_estudante", unique = true, nullable = true, insertable = true, updatable = true)
public Integer getCdEstudante() {
   return this.cdEstudante;
}

public void setCdEstudante(Integer cdEstudante) {
   this.cdEstudante = cdEstudante;
}

@OneToOne(targetEntity = org.test.EstEnderecoPais.class, mappedBy = "estudante", fetch = FetchType.LAZY)
public EstEnderecoPais getEstEnderecoPais() {
   return this.estEnderecoPais;
}

public void setEstEnderecoPais(EstEnderecoPais estEnderecoPais) {
   this.estEnderecoPais = estEnderecoPais;
}
}


Code:
@Entity
@Table(name = "est_endereco_pais", schema = "ingres", uniqueConstraints = {})
public class EstEnderecoPais implements java.io.Serializable {

private Integer cdEstudante;

private Estudante estudante;

@Id
@Column(name = "cd_estudante", unique = true, nullable = false, insertable = true, updatable = true)
public Integer getCdEstudante() {
   return this.cdEstudante;
}

public void setCdEstudante(Integer cdEstudante) {
   this.cdEstudante = cdEstudante;
}

@OneToOne(targetEntity = org.test.Estudante.class, cascade = CascadeType.ALL, fetch = FetchType.LAZY)
@JoinColumn(name = "cd_estudante", nullable = true)
public Estudante getEstudante() {
   return this.estudante;
}

public void setEstudante(Estudante estudante) {
   this.estudante = estudante;
}
}


I looked at some other topics and i cannot found some solution that really works...

_________________
Diego Pires Plentz


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.