[Java lista] Unknown state or association field
Csaba Ragasits
ragasits.csaba at gmail.com
2007. Júl. 2., H, 17:43:40 CEST
Most mar kezdek teljesen belezavarodni :(
Itt a forrasom:
/*
* Feladat.java
*
* Created on 2007. június 15., 16:16
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package entity;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
/**
* Entity class Feladat
*
* @author ragasitscs
*/
@Entity
@Table(name = "FELADAT")
@NamedQueries( {
@NamedQuery(name = "Feladat.findById", query = "SELECT f FROM
Feladat f WHERE f.id = :id"),
@NamedQuery(name = "Feladat.findByRogzitve", query = "SELECT f
FROM Feladat f WHERE f.rogzitve = :rogzitve"),
@NamedQuery(name = "Feladat.findByIdotartam", query = "SELECT
f FROM Feladat f WHERE f.idotartam = :idotartam"),
@NamedQuery(name = "Feladat.findByLezarva", query = "SELECT f
FROM Feladat f WHERE f.lezarva = :lezarva"),
@NamedQuery(name = "Feladat.findByBelyeg", query = "SELECT f
FROM Feladat f WHERE f.belyeg = :belyeg"),
@NamedQuery(name = "Feladat.findByFelhasznaloId", query =
"SELECT f FROM Feladat f WHERE f.felhasznalo_id = :felhasznaloId")
})
public class Feladat implements Serializable {
@Id
@Column(name = "ID")
private Integer id;
@Column(name = "ROGZITVE")
@Temporal(TemporalType.TIMESTAMP)
private Date rogzitve;
@Lob
@Column(name = "LEIRAS")
private String leiras;
@Column(name = "IDOTARTAM")
private Short idotartam;
@Column(name = "LEZARVA")
private Character lezarva;
@Column(name = "BELYEG")
@Temporal(TemporalType.TIMESTAMP)
private Date belyeg;
@JoinColumn(name = "FELADATTIPUS_ID", referencedColumnName = "ID")
@ManyToOne
private Feladattipus feladattipus;
@JoinColumn(name = "FELHASZNALO_ID", referencedColumnName = "ID")
@ManyToOne
private Felhasznalo felhasznalo;
@JoinColumn(name = "ROGZITETTE", referencedColumnName = "ID")
@ManyToOne
private Felhasznalo rogzitette;
/** Creates a new instance of Feladat */
public Feladat() {
}
/**
* Creates a new instance of Feladat with the specified values.
* @param id the id of the Feladat
*/
public Feladat(Integer id) {
this.id = id;
}
/**
* Gets the id of this Feladat.
* @return the id
*/
public Integer getId() {
return this.id;
}
/**
* Sets the id of this Feladat to the specified value.
* @param id the new id
*/
public void setId(Integer id) {
this.id = id;
}
/**
* Gets the rogzitve of this Feladat.
* @return the rogzitve
*/
public Date getRogzitve() {
return this.rogzitve;
}
/**
* Sets the rogzitve of this Feladat to the specified value.
* @param rogzitve the new rogzitve
*/
public void setRogzitve(Date rogzitve) {
this.rogzitve = rogzitve;
}
/**
* Gets the leiras of this Feladat.
* @return the leiras
*/
public String getLeiras() {
return this.leiras;
}
/**
* Sets the leiras of this Feladat to the specified value.
* @param leiras the new leiras
*/
public void setLeiras(String leiras) {
this.leiras = leiras;
}
/**
* Gets the idotartam of this Feladat.
* @return the idotartam
*/
public Short getIdotartam() {
return this.idotartam;
}
/**
* Sets the idotartam of this Feladat to the specified value.
* @param idotartam the new idotartam
*/
public void setIdotartam(Short idotartam) {
this.idotartam = idotartam;
}
/**
* Gets the lezarva of this Feladat.
* @return the lezarva
*/
public Character getLezarva() {
return this.lezarva;
}
/**
* Sets the lezarva of this Feladat to the specified value.
* @param lezarva the new lezarva
*/
public void setLezarva(Character lezarva) {
this.lezarva = lezarva;
}
/**
* Gets the belyeg of this Feladat.
* @return the belyeg
*/
public Date getBelyeg() {
return this.belyeg;
}
/**
* Sets the belyeg of this Feladat to the specified value.
* @param belyeg the new belyeg
*/
public void setBelyeg(Date belyeg) {
this.belyeg = belyeg;
}
/**
* Gets the feladattipusId of this Feladat.
* @return the feladattipusId
*/
public Feladattipus getFeladattipus() {
return this.feladattipus;
}
/**
* Sets the feladattipusId of this Feladat to the specified value.
* @param feladattipusId the new feladattipusId
*/
public void setFeladattipus(Feladattipus feladattipusId) {
this.feladattipus = feladattipusId;
}
/**
* Gets the felhasznaloId of this Feladat.
* @return the felhasznaloId
*/
public Felhasznalo getFelhasznalo() {
return this.felhasznalo;
}
/**
* Sets the felhasznaloId of this Feladat to the specified value.
* @param felhasznaloId the new felhasznaloId
*/
public void setFelhasznalo(Felhasznalo felhasznalo) {
this.felhasznalo = felhasznalo;
}
/**
* Gets the rogzitette of this Feladat.
* @return the rogzitette
*/
public Felhasznalo getRogzitette() {
return this.rogzitette;
}
/**
* Sets the rogzitette of this Feladat to the specified value.
* @param rogzitette the new rogzitette
*/
public void setRogzitette(Felhasznalo rogzitette) {
this.rogzitette = rogzitette;
}
/**
* Returns a hash code value for the object. This implementation computes
* a hash code value based on the id fields in this object.
* @return a hash code value for this object.
*/
@Override
public int hashCode() {
int hash = 0;
hash += (this.id != null ? this.id.hashCode() : 0);
return hash;
}
/**
* Determines whether another object is equal to this Feladat.
The result is
* <code>true</code> if and only if the argument is not null and
is a Feladat object that
* has the same id field values as this object.
* @param object the reference object with which to compare
* @return <code>true</code> if this object is the same as the argument;
* <code>false</code> otherwise.
*/
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id
fields are not set
if (!(object instanceof Feladat)) {
return false;
}
Feladat other = (Feladat)object;
if (this.id != other.id && (this.id == null ||
!this.id.equals(other.id))) return false;
return true;
}
/**
* Returns a string representation of the object. This
implementation constructs
* that representation based on the id fields.
* @return a string representation of the object.
*/
@Override
public String toString() {
return "ejb.Feladat[id=" + id + "]";
}
}
Zsombor <gzsombor at gmail.com> írta, 2007.07.02.:
>
>
> On 7/2/07, Csaba Ragasits <ragasits.csaba at gmail.com> wrote:
> > Hello,
> >
> > Thx, a valaszokat!
> >
> > Valojaban olyan lekerdezest szeretnek letrehozni, ahol csak az adott
> > felhasznalohoz tartozo feladatok jelennek meg.
> >
> > Janos Cserep <cserepj at gmail.com > írta, 2007.07.02.:
> > > De szerintem jobban jarsz, ha f.felhasznalo = <felhasznaloojjektum>
> szintet
> > > kezded el hasznalni, es rabizod az ORM-re, hogy tudja, hogy mi a
> felhasznalo
> > > id-ja. Sokkal ojjektumorientaltabb lesz a program.
> >
> > Rabiznam az ORM-re, de ezt hogyan lehet vele megcsinalni?
> >
> > Gondoltam, hogy vegig megyek soronkent a tablan, majd csak a
> > megfeleloket adom tovabb a kliensenk, de ez nagyon fapados, ennek
> > biztosan van jobb megoldas...
> >
> > Csaba
>
>
> Ezt csinálja a query-d. Nem értem a problémát.
>
> Zs
>
> _______________________________________________
> Javalist mailing list
> Javalist at javagrund.hu
> http://javagrund.hu/mailman/listinfo/javalist
>
>
További információk a(z) Javalist levelezőlistáról