Hi everybody,
I get the following error:
java.lang.Exception: org.hibernate.exception.SQLGrammarException: could not load an entity: [de.interkulturellesPortal.dao.training.TrainingDestiny#1]
I try to get the object of TrainingDestiny with the id 1. This is my class TrainingDestiny:
Code:
@Entity
@Table(name = "ikPortalTrainingDestiny")
public class TrainingDestiny {
private int trainingDestinyId;
private boolean interculturalTraining;
private boolean interculturalCoaching;
private boolean interculturalMediation;
private boolean languageTraining;
private boolean interpreterTranslator;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
public int getTrainingDestinyId() {
return trainingDestinyId;
}
public void setTrainingDestinyId(int trainingDestinyId) {
this.trainingDestinyId = trainingDestinyId;
}
@Column(name = "interculturalTraining")
public boolean isInterculturalTraining() {
return interculturalTraining;
}
public void setInterculturalTraining(boolean interculturalTraining) {
this.interculturalTraining = interculturalTraining;
}
@Column(name = "interculturalCoaching")
public boolean isInterculturalCoaching() {
return interculturalCoaching;
}
public void setInterculturalCoaching(boolean interculturalCoaching) {
this.interculturalCoaching = interculturalCoaching;
}
@Column(name = "interculturalMediation")
public boolean isInterculturalMediation() {
return interculturalMediation;
}
public void setInterculturalMediation(boolean interculturalMediation) {
this.interculturalMediation = interculturalMediation;
}
@Column(name = "languageTraining")
public boolean isLanguageTraining() {
return languageTraining;
}
public void setLanguageTraining(boolean languageTraining) {
this.languageTraining = languageTraining;
}
@Column(name = "interpreterTranslator")
public boolean isInterpreterTranslator() {
return interpreterTranslator;
}
public void setInterpreterTranslator(boolean interpreterTranslator) {
this.interpreterTranslator = interpreterTranslator;
}
}
And this is the code of my get()-method:
Code:
public static TrainingDestiny get(int id) throws Exception {
Session session = null;
try {
session = HibernateUtil.getSessionFactory().getCurrentSession();
session.beginTransaction();
//System.out.println("Klasse: " + objectType.getClass());
TrainingDestiny trainingDestiny = (TrainingDestiny)session.get(TrainingDestiny.class, id);
session.getTransaction().commit();
return trainingDestiny;
}
catch(Exception e) {
throw new Exception(e);
}
finally {
HibernateUtil.closeSession(session);
}
}
For example, I call the get()-method with the primary key 1. The corresponding row in the tables exists. But I get this exception. Does andybody know the reason?
Kind regards,
Christopher