Hibernate generation Id to postgreSQL

Hibernate generation Id to postgreSQL

Hi,

I'm trying to implement a id generator in Hibernate, but I'm having a problem. Hibernate doesn't seems to reset the counting when the id is generated. For example:

1 - In PostgreSQL I have a table (that entries were done with Hibernate script):

carId|car_description

1|john

2|mike

3|Peter

2 - Now, I clean the table, and next time I insert a new value on car_description, when I think that hibernate catch the min value(0 because the db is empty), it inserts the last value created (saved in memory perhaps).

carId|car_description

4|Michael

My class is:

@Entity @Table(name="tb_career") public class Career implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="seq_career") @SequenceGenerator(initialValue = 1, allocationSize = 1, name = "seqcareer", sequenceName = "seqcareer")

@Column(name="car_id", unique=true, nullable=false)
private Integer carId;
@Column(name="car_description", length=255)
private String carDescription;
//bi-directional many-to-many association to Course
@ManyToMany(mappedBy="tbCareers")
private List<Course> tbCourses;

Kind Regards! Thanks!

View Answers

Ads









Related Tutorials/Questions & Answers:
Hibernate generation Id to postgreSQL
Hibernate generation Id to postgreSQL  Hi, I'm trying to implement a id generator in Hibernate, but I'm having a problem. Hibernate doesn't seems to reset the counting when the id is generated. For example: 1 - In PostgreSQL I
id generation
id generation  CREATE TABLE `mohan2` ( `sno` bigint(20) NOT NULL... to employee id automatically generate please try this code, useful for u thanks ...");%> any body want to employee id automatically generate please try
Advertisements
hibernate postgresql 9.4 dialect
hibernate postgresql 9.4 dialect  Hi, Which is the hibernate postgresql 9.4 dialect? Thanks   Hi, The postgresql 9.4 dialect...; Hi, This is available in Hibernate ORM 5.2. Thanks
hibernate postgresql 9.4 dialect
hibernate postgresql 9.4 dialect  Hi, Which is the hibernate postgresql 9.4 dialect? Thanks   Hi, The postgresql 9.4 dialect...; Hi, This is available in Hibernate ORM 5.2. Thanks
hibernate postgresql 9.4 dialect
hibernate postgresql 9.4 dialect  Hi, Which is the hibernate postgresql 9.4 dialect? Thanks   Hi, The postgresql 9.4 dialect...; Hi, This is available in Hibernate ORM 5.2. Thanks
Hibernate criteria by id.
Hibernate criteria by id.  How to display record by using criteria by id in Hibernate
Hibernate criteria by id.
Hibernate criteria by id.  How to display record by using criteria by id in Hibernate?   Here is an example - package...(); } } Output: Hibernate: select this_.emp_id as emp1_0_0_, this_.date_of_join
id
id  how to find date of birth and gender in id in html with the help of javascript
Hibernate id annotation
In this section, you will learn how to do mapping of id through annotation
Version of postgresql>postgresql dependency
List of Version of postgresql>postgresql dependency
Hibernate Example
This section contains a simple Hibernate 4 example using Annotation with source code. The eclipse id and Apache Tomcat is used in this example
pdf generation.
pdf generation.  i want to generate the data which is stored in mysql data base in pdf format with php. how i will do
hibernate sample code
This section contains a simple Hibernate 4 example using Annotation with source code. The eclipse id and Apache Tomcat is used in this example
Barcode generation
Barcode generation  hi, I am working on a project where there is a alias no. with symbology EAN-13 for generation of barcode... now i have to write the logic for one item no if their are two or more quantities it should
Artifacts of postgresql
List of Artifacts of postgresql maven depenency
HIBERNATE
HIBERNATE   What is difference between Jdbc and Hibernate
hibernate
hibernate  what is hibernate listeners
hibernate
hibernate  what is hibernate flow
PDF Generation for unicode characters
PDF Generation for unicode characters  Hi, How a PDF file having unicode characters is generated in JSP
hibernate
hibernate  please give me the link where i can freely download hibernate software(with dependencies)   Learn hibernate, if you want to learn hibernate, please visit the following link: Hibernate Tutorials
Hibernate
Hibernate  hibernate delete query execution
hibernate
hibernate  what is hibernate why we use
Hibernate
Hibernate  how to use pagination concept in Hibernate
Hibernate 4 Simple Example
(first_name, last_name, salary) values (?, ?, ?) Hibernate: select worker0_.id... Last Name: Abraham Salary: 10000 Hibernate: select worker0_.id as id0_0..._.salary as salary0_0_ from Worker worker0_ where worker0_.id=? Hibernate: update
hibernate
hibernate   I want to learn how to use hibernate framework in web application . for storing database in our application
hibernate
hibernate   I want to learn how to use hibernate framework in web application . for storing database in our application
<form id=
form id  sir, <form id="reg1" action="../UploadingCtrl" method="post" enctype="multipart/form-data" name="form1"> this action page can't get String tp = request.getParameter("indegrates"). i wrote article upload
<form id=
form id  sir, <form id="reg1" action="../UploadingCtrl" method="post" enctype="multipart/form-data" name="form1"> this action page can't get String tp = request.getParameter("indegrates"). i wrote article upload
hibernate
why hibernate?  why hibernate?   Hibernate: -Hibernate... library. It solves object-relational impedance mismatch problems. Hibernate makes the application development process easy Hibernate saves the development
hibernate
hibernate  why we should use hibernate projection
Hibernate
Hibernate  Please tell me the difference between hibernate and jdbc

Ads