-->
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: Double and Enum only get NULL values...
PostPosted: Tue Oct 21, 2008 7:51 am 
Regular
Regular

Joined: Fri Feb 09, 2007 3:47 pm
Posts: 56
Hibernate version:
3.3

Mapping documents:
Annotation Mapping

Code between sessionFactory.openSession() and session.close():
List<Stammversion>stamms=SessionFactory.getCurrentSession().createCriteria(Stammversion.class).list();

Name and version of the database you are using:
HSQLDB 1.8.0.10

My classes:
Code:
Stammversion.java:

import java.util.Collection;
import java.util.Vector;
import javax.persistence.Entity;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import org.hibernate.annotations.Cascade;

@Entity
public class Stammversion extends Versionierbar {

   private static final long serialVersionUID = 1899218284337518438L;
   
   public Stammversion() {
   }
   
   public static final String GEWICHT = StammversionMessages.Stammversion_GEWICHT;

   private Double gewicht;

   public Double getGewicht() {
      return this.gewicht;
   }
   
   public void setGewicht(Double gewicht) {
      this.gewicht = gewicht;
   }
}

Versionierbar:
import java.util.Vector;
import javax.persistence.Entity;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;

@Entity
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public abstract class Versionierbar extends EpdObject {

   private static final long serialVersionUID = 574912324692525957L;

   public static final String VERSIONINDEX = VersionierbarMessages.Versionierbar_VERSIONINDEX;
   public static final String STATUS = VersionierbarMessages.Versionierbar_STATUS;
   
   private Integer versionIndex;
   private EpdmStatus status;
   
   public Versionierbar() {
      super();
      versionIndex = 0;
      status = EpdStatus.IN_WORK;
   }
   
   public Integer getVersionIndex() {
      return versionIndex;
   }

   private void setVersionIndex(Integer versionIndex) {
      this.versionIndex = versionIndex;
   }

   public EpdStatus getStatus() {
      return status;
   }
   
   private void setStatus(EpdStatus status) {
      this.status = status;
   }
   
   @Override
   public String toString() {
      return getBezeichnung() + " " + getVersion();
   }
}


EpdObject:
import java.io.Serializable;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;

@Entity
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public abstract class EpdObject extends UiModelBean implements Identifiable, Serializable {

   private static final long serialVersionUID = 7127024240500513947L;

   public static final String UUID = EpdObjectMessages.EpdObject_UUID;
   public static final String BEZEICHNUNG = EpdObjectMessages.EpdObject_BEZEICHNUNG;

   @Id
   private String uuid;
   private String bezeichnung;

   public String getUuid() {
      return uuid;
   }

   private void setUuid(String uuid) {
      this.uuid = uuid;
   }

   public String getBezeichnung() {
      return this.bezeichnung;
   }

   public void setBezeichnung(String bezeichnung) {
      this.bezeichnung = bezeichnung;
   }

   public EpdObject(String bezeichnung, String bezeichnung2) {
      this.bezeichnung = bezeichnung;
      uuid = createUUID();
   }

   protected EpdObject() {
      uuid = createUUID();
   }
   
   private String createUUID() {
      return this.toString() + "_" + java.util.UUID.randomUUID().toString().substring(16);
   }

   @Override
   public String toString() {
      return getBezeichnung();
   }

}


MY PROBLEM:
---------------
When I load the Stammversion objects with
List<Stammversion>stamms=SessionFactory.getCurrentSession().createCriteria(Stammversion.class).list();

the fields EpdStatus (Integer in DB) and gewicht (DOUBLE in DB) won't contain the values which are stored in the DB but only NULL.

Who can help me?
Thank you very much!


--> sorry, bin ja hier im deutschen Forum:

Beim laden der Stammversion Objekte mit dieser Zeile
List<Stammversion>stamms=SessionFactory.getCurrentSession().createCriteria(Stammversion.class).list();

werden die Felder EpdStatus (Integer in DB) and gewicht (DOUBLE in DB) nicht mit den Werten aus der DB sondern mit NULL gefüllt. Das gilt nicht für Felder der Vaterklasse EpdObject sondern nur für Objekte der abgeleiteten Klassen!

Vielen Dank für jede Hilfe!


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.