-->
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.  [ 3 posts ] 
Author Message
 Post subject: null id
PostPosted: Sat Oct 20, 2007 12:50 pm 
Newbie

Joined: Sat Oct 20, 2007 12:34 pm
Posts: 2
Hibernate version: 3.2
Name and version of the database you are using: HSQLDB 1.8.0.7
External Libraries: GWT, Hibernate4GWT, HiberGeneration

I have a table Utenti automatically generated by HiberGeneration (http://objectgeneration.com/eclipse/).
Utenti.hmb.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<!-- Generated by HiberObjects. DO NOT EDIT! -->
<hibernate-mapping>
   <class name='it.pep.gwtesami.domain.Utenti' table='tb_utenti'>
      <id name='id' type='long' column='ID'>
         <generator class='native' />
      </id>
      <property  column='nome' unique='true' type='string' name='nome'>
      </property>
      <property  column='pword' type='string' name='pword'>
      </property>
      <many-to-one  foreign-key='fk_utenti_domini_id' class='it.pep.gwtesami.domain.Domini' not-null='true' cascade='save-update' name='domini'>
         <column name='domini_id'/>
      </many-to-one>
   </class>
</hibernate-mapping>


source file Utenti.java
Code:
package it.pep.gwtesami.domain;

import net.sf.hibernate4gwt.pojo.gwt.LazyGwtPojo;

import com.google.gwt.user.client.rpc.IsSerializable;


/**
* @generated
*/
public class Utenti extends LazyGwtPojo{
   /**
    * @generated
    */
   private String nome;
   /**
    * @generated
    */
   private String pword;
   /**
    * @generated
    */
   private Domini domini;

   /**
    * @generated
    */
   private Long id;

   /**
    * @generated
    */
   public Utenti() {
   }

   /**
    * @generated
    */
   public String toString() {
      return "Utenti" + " nome=" + nome + " pword=" + pword + " id=" + id;
   }

   /**
    * @generated
    */
   public String getNome() {
      return this.nome;
   }

   /**
    * @generated
    */
   public void setNome(String nome) {
      this.nome = nome;
   }

   /**
    * @generated
    */
   public String getPword() {
      return this.pword;
   }

   /**
    * @generated
    */
   public void setPword(String pword) {
      this.pword = pword;
   }

   /**
    * @generated
    */
   public Domini getDomini() {
      return this.domini;
   }

   /**
    * @generated
    */
   public void setDomini(Domini domini) {
      this.domini = domini;
   }

   /**
    * @generated
    */
   public Long getId() {
      return this.id;
   }

   /**
    * @generated
    */
   public void setId(Long id) {
      this.id = id;
   }
}


when I use the statement
Code:
System.out.println("id: "+anUtente.getId());

I got null id. The same for every table and relation of database, the id is ever null.
Can you help me?
Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Oct 20, 2007 1:50 pm 
Newbie

Joined: Wed Sep 05, 2007 2:26 am
Posts: 5
Hi,

Can you give me the creation steps for Object: anUtente

Sanjeev


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 22, 2007 9:49 am 
Newbie

Joined: Sat Oct 20, 2007 12:34 pm
Posts: 2
I apologize for the message, it was my fault. Thanks.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

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.