primary key « Insert « JPA Q&A





1. Hibernate Duplicate entry '1' for key 'PRIMARY' on first insert to table    stackoverflow.com

I receive the error Duplicate entry '1' for key 'PRIMARY' when I first insert into a table (after a drop/create of my db). This causes a rollback. If I execute again ...

2. inserting demo data in hibernate without the primary key    stackoverflow.com

i am using hibernate 3 and PostgreSQL database and i am trying to insert demo data in hibernate import.sql file without inserting the primary key

insert into AUTHORITY (NAME, DISPLAY_NAME, DESCRIPTION,IS_DEFAULT) values ('ROLE_USER', ...

3. Insert data and get the primary key based on seq Postgresql    forum.hibernate.org

Hi All, I am new to Hibernate. From last some days I have searched most of the forum post and Hibernate Ref documentation. Here is my problem. Coupld someone help me. I have got very complex Database schema and presently I am using handwritten DAO with postgreSQL database to insert the record using database sequence. Is it possible from hibernate to ...

4. How to insert into a table without primary key    forum.hibernate.org

Hi everyone, I am recently working with Hibernate and have got a problem. First I have got a table in postgresql created with a primary key as below. CREATE TABLE SB_USER_ROLES( userid INTEGER NOT NULL, roleid INTEGER NOT NULL, FOREIGN KEY (userid) REFERENCES SB_USERS(userid) ON DELETE CASCADE, FOREIGN KEY (roleid) REFERENCES SB_ROLES(roleid) ON DELETE CASCADE ); userid and roleid in table ...

5. Inserting a row in a table with no primary/secondary key    forum.hibernate.org

I assume your log table will have a timestamp column (what log doesn't?). Can you use that column as the ID/primary key, or many a composite-id of the timestamp and something else (like a threadId)? It would be best if you add an ID column to the table. Of course if this is a legacy system it may be out of ...

6. How to get primary key of newly inserted object    forum.hibernate.org

public void save(CostPeriod transientInstance) { if (log.isDebugEnabled()) { log.debug("saving CostPeriod instance"); } getHibernateTemplate().saveOrUpdate(transientInstance); ...

8. Error while inserting a row with duplicate Primary key    forum.hibernate.org

Scenario My program is a Simple Swing program which asks the user to input a Message ID and a Message Text to store in a Mesage table which is created by hibernate itself. It works perfect as long as the user enters different message ids. But it crashes when the user enters a duplicate Message id as its a primary key. ...

9. Name of primary keys in DDL    forum.hibernate.org

We generate DDL scripts based on Hibernate mappings. We need to name the primary keys (due to our customer's wish) like Constraint PK_ADDRESS primary key (ADDRESS_ID) Our mapping ... result in the following output create table ADDRESS ( ADDRESS_ID number(19,0) not null, primary key (ADDRESS_ID) ); Does anyone know ...





10. Missing auto generate primary key and foreign key for insert    forum.hibernate.org

Newbie Joined: Wed Oct 03, 2007 9:10 pm Posts: 1 Hi Hibernate newbie here. I am using Hibernate + Spring + MySQL. I have an entity (ScheduleData) that has a list of entities (JobParameter class). When Hibernate inserts the JobParameter data into the database, it does not generate a value for the primary key (The primary key has @Id and @GeneratedValue) ...

11. Changing the way Primary Keys are inserted into a table.    forum.hibernate.org

Hibernate version:1.2.8 Database version:Oracle 10g Dialect version:9i dialect Is it possible to change the way inserts are made to tables so that whenever a insert is made to the table the insert should also contain the pimary key. However the primary keys are only set after the data has been inserted and by an Update. Please see description below. I have ...