Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Hibernate Hibernate generation Id to postgreSQL

Have Programming Question? Ask it here!
 
 
 


Raul Estrela
Hibernate generation Id to postgreSQL
0 Answer(s)      2 years ago
Posted in : Hibernate


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!


Advertisement
View Answers

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
Automatic primary Generation in Hibernate - Hibernate
Automatic primary Generation in Hibernate   Hi, Ow primary key is generated automatically in hibernate.give me sample code.Thank u
sql script generation - Hibernate
sql script generation  he show_sql shows the sql statements but doesn't show the Create Table statements (the table definetions) on creation?? is there any way to do that in hibernate? Generate the sql script for tables
Hibernate criteria by id.
Hibernate criteria by id.  How to display record by using criteria by id in Hibernate
HIBERNATE COMPOSITE ID - Hibernate
HIBERNATE COMPOSITE ID  Hi, I have a database table structure as CREATE TABLE `attendance` ( `sno` int(11) NOT NULL auto_increment, `empRef` int(8) default NULL, `dat` date default NULL, `timeIn` time
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
Using Hibernate <generator> to generate id incrementally - Struts
Using Hibernate to generate id incrementally  Hi All, How to increment id using Hibernate ( or if any other) to generate id. I am using... on Hibernate visit to : http://www.roseindia.net/hibernate/index.shtml http
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
Table generation error - EJB
Table generation error  Hi friends I am using EJB3.0 with sun java system application server 9.1 with postgresql database. Actually when i make... "CREATE TABLE BookShop (ID INTEGER NOT NULL, BOOKNAME VARCHAR(255), AUTHOR VARCHAR
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
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
report generation using jsp
report generation using jsp  report generation coding using jsp
Excel File data upload into postgresql database in struts 1.x
Excel File data upload into postgresql database in struts 1.x  Dear members please explain how Excel Files data upload into postgresql database in struts 1.x
report generation - EJB
report generation   how to create the report in java
PDF Generation for unicode characters
PDF Generation for unicode characters  Hi, How a PDF file having unicode characters is generated in JSP
retrieving data in to the dropdown box from postgresql database in core java
retrieving data in to the dropdown box from postgresql database in core...=st.executeQuery("SELECT role_name from role WHERE dept_id=1234"); if(rs...) { JOptionPane.showMessageDialog(this, "The generated Id is:"); dispose
insert data using drop down box in java into database postgresql
and postgresql as data base syntax which i m using is like:- java class...("addressafterretirement", new Model()); public form1a(Integer emp_id) { eid=emp_id; Form form = new Form("f
insert data using drop down box in java into database postgresql
and postgresql as data base syntax which i m using is like:- java class...("addressafterretirement", new Model()); public form1a(Integer emp_id) { eid=emp_id; Form form = new Form("f
insert data using drop down box in java into database postgresql
and postgresql as data base syntax which i m using is like:- java class...("addressafterretirement", new Model()); public form1a(Integer emp_id) { eid=emp_id; Form form = new Form("f
insert data using drop down box in java into database postgresql
and postgresql as data base syntax which i m using is like:- java class...("addressafterretirement", new Model()); public form1a(Integer emp_id) { eid=emp_id; Form form = new Form("f
total id
total id  how to print and total my id number ..for example if my id is 0123456789 the output will look like this : 0123456789 0+1+2+3+4+5+6+7+8+9=45 help me plz
Session ID
Session ID  How can I change the session ID of the page?   ...' session ID values because it is very likely to result in the loss of the session or with people acquiring other users' data. The session ID value should be managed
<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 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
id creation
id creation  CREATE TABLE mohan2 ( sno bigint(20) NOT NULL AUTO_INCREMENT, name varchar(30) NOT NULL, sal int(30) NOT NULL, eid varchar(30) NOT NULL, PRIMARY KEY (sno,eid) ) import java.sql.*; import
Hibernate Synchronizer
Hibernate Synchronizer       Hibernate Synchronizer is a free Eclipse plugin code generation tool to be used with the Hibernate persistence framework. The plugin
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
Play framework dynamic form generation
Play framework dynamic form generation  I want to generate dynamic forms using play framework can any one give me some idea about dynamic form generation using play framework
php maintain session id
php maintain session id   How to maintain session ID for a user in PHP
Hibernate 4 Simple Example
_name, last_name, salary) values (?, ?, ?) Hibernate: select worker0_.id as id0...: Abraham Salary: 10000 Hibernate: select worker0_.id as id0_0_, worker0_.first... as salary0_0_ from Worker worker0_ where worker0_.id=? Hibernate: update Worker set
hibernate - Hibernate
hibernate  what is hibernate and how to make a pc hibernating?  Hi friend, Hibernate is based on object oriented concept like java... .properties file and in hibernate we use .xml file ,which is a better approach. We
how make ID - Ajax
how make ID  how make a ID in eyeball chat
ID number program
ID number program  hi can anyone help me with the following program. a program that can determine a person,s date of birth, age, gender and citizenship by just entering the id number. thanks in advance
HIBERNATE
HIBERNATE   What is difference between Jdbc and Hibernate
id sender uibutton
id sender uibutton  Hi, I want to find which button is clicked based on the id sender when UIButton is clicked. thanks   HI, Here is the code example: UIButton* myButton = (UIButton*)sender; NSLog(@"Button tag
hibernate
hibernate  what is hibernate listeners
hibernate
hibernate  what is hibernate flow
need to generate ID
need to generate ID  hai, i need to generate ID i.e when i select addemploye option and submit, it should generate a emp ID which is 1 greater than the previous highest ID value stored in database. eg: if the higest value
need to generate ID
need to generate ID  hai, i need to generate ID i.e when i select addemploye option and submit, it should generate a emp ID which is 1 greater than the previous highest ID value stored in database. eg: if the higest value
org.hibernate.MappingException: could not instantiate id generator
org.hibernate.MappingException: could not instantiate id generator  I am getting the following exception while running Hibernate example, pls..." org.hibernate.MappingException: could not instantiate id generator
org.hibernate.MappingException: could not instantiate id generator
org.hibernate.MappingException: could not instantiate id generator  I am getting the following exception while running Hibernate example, pls..." org.hibernate.MappingException: could not instantiate id generator
org.hibernate.MappingException: could not instantiate id generator
org.hibernate.MappingException: could not instantiate id generator  I am getting the following exception while running Hibernate example, pls..." org.hibernate.MappingException: could not instantiate id generator
org.hibernate.MappingException: could not instantiate id generator
org.hibernate.MappingException: could not instantiate id generator  I am getting the following exception while running Hibernate example, pls..." org.hibernate.MappingException: could not instantiate id generator
JQuery-Selecting class or ID
am getting little trouble in selecting an item using class or ID in jQuery?   Given below code selects an element of id name "element1" : $('#element1') Since IDs are unique, so it will select only the element of particular id
JQuery-Selecting class or ID
JQuery-Selecting class or ID  Hi Guys, I am new to JQuery. I am getting little trouble in selecting an item using class or ID in jQuery
Auto Generated Employee ID
Auto Generated Employee ID  Hello Everyone I want to generate an ID like (SCS-0001) and then it should be auto incremented each time a new employee add page is opens. I am using My Sql database
Advertisements
 

 

 

DMCA.com