-->
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.  [ 2 posts ] 
Author Message
 Post subject: Reverse Engineering generates wrong field types
PostPosted: Fri Sep 16, 2011 5:28 pm 
Newbie

Joined: Sat Aug 20, 2011 1:50 pm
Posts: 5
I use Eclipse Indigo with plugin Hibernate Tools (JBoss by red hat) for database connection I use Microsoft SQL Server 2008 JDBC Driver.

When I try to use Reverse Engineering tool (hibernate code generation configuration tool) to generate class based on database table, instead of fields with type of "string" I get "Serializable" type .

Code:
import java.io.Serializable;

/**
* Customers generated by hbm2java
*/
public class Customers implements java.io.Serializable {

   private Serializable customerId;
   private Serializable companyName;
   private Serializable contactName;
   private Serializable contactTitle;
   private Serializable address;
   private Serializable city;
   private Serializable region;
   private Serializable postalCode;
   private Serializable country;
   private Serializable phone;
   private Serializable fax;

   public Customers() {
   }

   public Customers(Serializable customerId, Serializable companyName) {
      this.customerId = customerId;
      this.companyName = companyName;
   }

   public Customers(Serializable customerId, Serializable companyName,
         Serializable contactName, Serializable contactTitle,
         Serializable address, Serializable city, Serializable region,
         Serializable postalCode, Serializable country, Serializable phone,
         Serializable fax) {
      this.customerId = customerId;
      this.companyName = companyName;
      this.contactName = contactName;
      this.contactTitle = contactTitle;
      this.address = address;
      this.city = city;
      this.region = region;
      this.postalCode = postalCode;
      this.country = country;
      this.phone = phone;
      this.fax = fax;
   }

   public Serializable getCustomerId() {
      return this.customerId;
   }

   public void setCustomerId(Serializable customerId) {
      this.customerId = customerId;
   }

   public Serializable getCompanyName() {
      return this.companyName;
   }

   public void setCompanyName(Serializable companyName) {
      this.companyName = companyName;
   }

   public Serializable getContactName() {
      return this.contactName;
   }

   public void setContactName(Serializable contactName) {
      this.contactName = contactName;
   }

   public Serializable getContactTitle() {
      return this.contactTitle;
   }

   public void setContactTitle(Serializable contactTitle) {
      this.contactTitle = contactTitle;
   }

   public Serializable getAddress() {
      return this.address;
   }

   public void setAddress(Serializable address) {
      this.address = address;
   }

   public Serializable getCity() {
      return this.city;
   }

   public void setCity(Serializable city) {
      this.city = city;
   }

   public Serializable getRegion() {
      return this.region;
   }

   public void setRegion(Serializable region) {
      this.region = region;
   }

   public Serializable getPostalCode() {
      return this.postalCode;
   }

   public void setPostalCode(Serializable postalCode) {
      this.postalCode = postalCode;
   }

   public Serializable getCountry() {
      return this.country;
   }

   public void setCountry(Serializable country) {
      this.country = country;
   }

   public Serializable getPhone() {
      return this.phone;
   }

   public void setPhone(Serializable phone) {
      this.phone = phone;
   }

   public Serializable getFax() {
      return this.fax;
   }

   public void setFax(Serializable fax) {
      this.fax = fax;
   }

}


Top
 Profile  
 
 Post subject: Re: Reverse Engineering generates wrong field types
PostPosted: Mon Jan 28, 2013 3:30 am 
Newbie

Joined: Mon Jan 28, 2013 3:20 am
Posts: 2
I am also facing exactly same problem. could anyone tell me the solution.

I am using Hibernate 4.0 and Sql Server 2008.
All nchar and nvarchar data types are generated as Serializable types in java pojo classes when I tried reverse engineering.

Thanks,
Spear


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.