new « Insert « JPA Q&A





1. Create new or update existing entity at one go with JPA    stackoverflow.com

A have a JPA entity that has timestamp field and is distinguished by a complex identifier field. What I need is to update timestamp in an entity that has already been ...

2. Can new @Immutable entity be inserted    stackoverflow.com

I have an entity I want to be insert only. All of the documentation I've found says that an entity annotated with @Immutable cannot be updated, small "u" updated. ...

3. Problem with inserting new data into database using hibernate    coderanch.com

I am getting the following exception when i try to insert into the database. Hibernate: insert into his1.ln_m_users (USERID, PASSWORDA, PRIMARY_GP_ID) values (?, ?, ?) an assertion failure occured (this may indicate a bug in Hibernate, but is more likely due to unsafe use of the session) java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.hibernate.util.GetGeneratedKeysHelper.getGeneratedKey(GetGeneratedKeysHelper.java:69) at org.hibernate.id.IdentityGenerator$GetGeneratedKeysDelegate.executeAndExtract(IdentityGenerator.java:74) ...

4. Create new table partition with Hibernate on Insert    coderanch.com

How can I use Hibernate to create new partitions based upon a field value or primary key generator? When I insert a new row in a table and is inputing a new value on the column which the table is partitioned, how can I get Hibernate to create this partition? Edit: The correct phrase may be how to add an partition ...

6. Unable to insert a new row in the table from Java program    forum.hibernate.org

Hi, I executed the below Java code. HibernateFactory.buildSessionFactory(); SessionFactory sessionFactory= HibernateFactory.getSessionFactory(); HibernateTemplate template= new HibernateTemplate(sessionFactory); Event event = new Event(); event.setName("Spring"); template.saveOrUpdate(event); And the Event class has the setName() method /** * @hibernate.property column="name" * @return */ public String getName() { return name; } public void setName(String name) { this.name = name; } And the hibernate.cfg.xml file has the below mapping ...

7. When the new record is inserted    forum.hibernate.org

8. Problem inserting a new record    forum.hibernate.org

Hi, I have this problem inserting new records, im a newbie on hibernate. I made my table in oracle, the primary key is a VARCHAR2(10) called COD_TIPO_CUENTA, I allready debuged the Action class and the properties are comming rigth from the form. I cant realize what is happenning. Please help me. Hibernate version: hibernate2.jar Mapping documents:

9. how to insert new data into these 2 tables    forum.hibernate.org

b]Hibernate version:[/b] 2.1 Mapping documents: I have a table which is create table A( id NUMBER(19,0), name VARCHAR2(255), primary key (id) ) and another table create table B( id NUMBER(19,0), version NUMBER(10,0), filedName VARCHAR2(255), primary key(id, version) ) table A's primary key is id, table A's primary key is (id, version) mapping file:





10. Get column value for a new row that is inserted    forum.hibernate.org

Hello, The primary key for the row gets incremented to the next max value using a trigger at the time of inserting a new row. When i immediately try to get the value of this primary key, for the new row that was inserted, using a select statement: "select max(recID) from rec", a error is thrown saying "FROM keyword where was ...

11. Why is delete being called prior to insert on a *new* object    forum.hibernate.org

I'm seeing some weird behavior with new transient objects being saved for the first time. The transient object, say Foo, has a child Set of "related" Foo instances. It's a one-to-many back to itself. When I create a new Foo instance and also add some related Foo elements in the relatedFoo set what I'm seeing is that hibernate will insert the ...

12. Can Insert new rows, but Can't update the rows. Please Help!    forum.hibernate.org

The mapping is a simple 1-to-many relationships. I was able to insert new rows, but I can't update them. The program doesn't complain, nor does it throw any exceptions. I turned on show_sql to true, and I don't see any update statements. This is a simple program, but not sure why it doesn't work. Thanks in advance. public class Status implements ...

13. HistoryEnabled objects (insert new row on update)    forum.hibernate.org

Author Message geirgp Post subject: HistoryEnabled objects (insert new row on update) Posted: Mon Feb 19, 2007 7:09 am Newbie Joined: Wed Jan 24, 2007 12:30 pm Posts: 2 HistoryEnabled objects. On the project I'm currently on we need a feature that enables the user to see what data look like at any point in time. To me this ...

14. How do I insert only new rows in a collection?    forum.hibernate.org

Beginner Joined: Thu Oct 13, 2005 3:40 pm Posts: 29 I accidentally posted this in NHibernate Users group. reposting ... I have a class called Request that has an idbag of Comments. I am using the saveOrUpdate() method to save the request object. Based on the documentation, I should be updating the createTs column and better still, one would expect only ...

15. Newly inserted data not fetched    forum.hibernate.org

Hello all, I have been banging my head for 2 days with this problem, i have read the docs and googled everywhere without a clue. My scenario is the following: Im working with Sun's JSF and Icefaces. When i insert some data for example i add a new comment to a story then the comment is saved to the database just ...

16. Insert new entity which inherites from another entity....    forum.hibernate.org

??????...:-((((( I changed my classes to... Code: @Entity @Inheritance(strategy = InheritanceType.SINGLE_TABLE) @Cache(usage = CacheConcurrencyStrategy.READ_WRITE) public class Person implements Serializable { // entities, which I want to inherit in OtherUser } @Entity @SecondaryTable(name = "OTHER_USER", pkJoinColumns = @PrimaryKeyJoinColumn(name = "PERSON_ID")) public class OtherUser extends Person { private Date validity; } And I really need ...





17. How to insert only new objects in hierarchy    forum.hibernate.org

Hi, I have two classes one is Person and another one is car. public class Person { protected int oid;//key column protected String name; protected Car car; public Person() { } public int getOid() { return oid; } public void setOid(int oid) { this.oid = oid; } public String getName() { return name; } public void setName(String name) { this.name = ...