-->
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: Unknown column, but I don't know why
PostPosted: Mon Jun 08, 2009 11:10 am 
Beginner
Beginner

Joined: Sat Oct 18, 2008 10:25 am
Posts: 30
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


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.