-->
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: Problème lors de l'ajout d'une ligne avec save()
PostPosted: Thu Sep 23, 2010 4:36 am 
Newbie

Joined: Thu Sep 23, 2010 4:00 am
Posts: 2
Bonjour,

Je suis nouveau depuis une semaine avec Hibernate, et lors de l'ajout d'une ligne avec la méthode save(), j'aimerai ne pas inclure dans la requête le champ id (clé primaire) car ce champ est géré directement par PostgreSQL(type serial). Comment pourrai-je faire pour y arriver?

Merci d'avance


Top
 Profile  
 
 Post subject: Re: Problème lors de l'ajout d'une ligne avec save()
PostPosted: Thu Sep 23, 2010 7:27 am 
Newbie

Joined: Thu Sep 23, 2010 4:43 am
Posts: 10
Hi,

as i understand;

you can use hibernate autogenerate annotation on top of id column,
then you do not need to put id value into request.

@Id
@GeneratedValue(strategy = GenerationType.AUTO)
public Integer getId() {
return id;
}


Top
 Profile  
 
 Post subject: Re: Problème lors de l'ajout d'une ligne avec save()
PostPosted: Thu Oct 14, 2010 5:44 pm 
Newbie

Joined: Thu Sep 23, 2010 4:00 am
Posts: 2
I use XML files, but it's ok now. Thanks a lot


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.