-->
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: Hibernate4 Assigned @Id Problem
PostPosted: Fri Jun 01, 2012 8:57 am 
Newbie

Joined: Fri Jun 01, 2012 8:08 am
Posts: 1
Hello,

I have the following problem. I have an entity with @Id property thats its not Generated by
Hibernate (its an user input). For some reason, my entity its not persisted when i call a save action.
If i put this same entity to have a generated value (@GeneratedValue) its work like it should.
Do you some idea what is it?

Im using hibernate 4.1.1.Final (Tested with 4.0.0.Final too) and Spring 3.1.
I tryed it first on Postgres 8.4 and now on DB2 and same behavior.

Code:
public class FormaArrecadacao  {

        @Id
   @Column(name = "CFMARRCODI", length = 1, unique = true, nullable = false)
   private String id;
}

public class FormaDAO ..{

@Override
   public FormaArrecadacao incluir(final FormaArrecadacao  entity) {
      getSession().save(entity);
      return entity;
   }
}


And yes.. im using @Transactional on my methods on Controller.

Any clues?


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.