generate « Insert « JPA Q&A





1. Hibernate Specific DDL Generation    stackoverflow.com

i'm using hibernate schema export tool. As I'm using MySql as RDBMS provider, i wonder if i can place specific mysql parameters somewhere ,like using collation utf8_bin ... Thanks

2. Inserting a generated value into a Hibernate record    stackoverflow.com

I am creating a record of Widgets with Hibernate. It's pretty basic. I've got an hbm.xml file describing the object, a DAO class that creates and saves them, etc. However, ...

3. Hibernate insert fails due to generate key failure    coderanch.com

Hi, My web application is able to read data from the database via Hibernate. However, it fails when it needs to do an INSERT with a generate key failure. Has anyone come across this error? I've been bang my head for the past 1 week to figure it out and I'm getting frustrated. I'm using the following: Hibernate3 String MS SQL ...

4. Hibernate: Optimization: id generation & two step insert    coderanch.com

Hey guys, Question on optimizing hibernate's SQL generation when inserting into a table using "sequence" generation of the primary key. Basically what I've noticed is that when hibernate generates the SQL for an insert it is doing so in two steps. 1) Select NEXTVAL FOR SQ_MySequence FROM SYSIBM.dummy1 2) INSERT using the value from step 1 as the primary key Obviously ...

5. Generating DDL from hibernate    coderanch.com

Woohoo! I just discovered you can do that! Configuration cfg = HibernateSessionFactory.getConfiguration(); String[] lines = cfg.generateSchemaCreationScript(new DerbyDialect()); Result: create table CLASSICCARS.ECHO_MESSAGE (ID bigint not null, MSG varchar(255), primary key (ID)); Small problem: I already have my schemas and don't want to drop them. So I thought I'll do update: Configuration cfg = HibernateSessionFactory.getConfiguration(); //new Configuration(); Session s = HibernateSessionFactory.getSession(); Connection c ...

6. Problem with Hibernate generated insert statement    forum.hibernate.org

Hi, my basic problem is that I am trying to use hibernate to insert a record but I keep getting an exception because it is trying to insert '' into date fields that aren't filled and this is the wrong syntax. More info: I am using Postgres 8.4. I am reading the SQL using p6spy My exception message is "Exception: org.hibernate.exception.DataException: ...

7. Incorrect insert statement generated by Hibernate    forum.hibernate.org

Hello, I'm using JPA with Hibernate 3.5.6 as the persistence provider. I've mapped some entities using JPA annotations and I'm using database schema generated by Hibernate, but I'm encountering incorrect SQL insert statements in runtime when trying to persist on of the entities. Here are the entitites: Code: @Entity @Table( name = "Game" ) public class MatchEntity implements Match, Serializable { ...

8. how to generate DDL of single table    forum.hibernate.org





11. Invalid DDL generated by Hibernate    forum.hibernate.org

13. 2.1 beta4 update() generates INSERT sql    forum.hibernate.org

14. on insert: generate id in a different table    forum.hibernate.org

i'm trying to achieve the following behaviour with hibernate (2.1.3) and a mysql database (4.x): several tables should share some kind of an unique identifier, (called "uniqueid" for example) which can be used as refernce to any kind of data in any table. the mapping: Code: ...

15. Direct SQL INSERT and ID generation    forum.hibernate.org

Question: I need to batch insert/update ~20000 records in a PERSON table. I've read the "Batch processing in Hibernate" paper and would like to use direct JDBC statements. However, the PERSON table is also mapped to a Person class, which is used in the application to create new persons from a web front-end. So my batch INSERT should use new IDs ...





17. DDL generation fails without error    forum.hibernate.org

Hi, I try to generate DDL with hbm2ddl using annotations. It works for small tests, but fails on a large model (over 50 classes) without giving an error message! If I remove classes, I do get error messages that classes are not mapped that are needed for OneToMany etc. So I cannot figure out which class is causing problems.... I use: ...

18. Cascade save generates update instead of insert for retry    forum.hibernate.org

Hi All, I have a table(SemiFlatTo) which has two children(Child1To and Child2To). And they are related by column which is generated by sequence "VAE_SEQ". My requirement is to do cascade save of all three tables. well everuthing works fine now. But lately I got another requirement, in which I have to save collection of SemiFlatTo's as batch update. In this case, ...

19. Auto-generated key and errors on insert    forum.hibernate.org

Apparently, the trans.rollback() does not set back the value of the property: Code: Session session = sessionFactory.openSession(this.getConnection()); Transaction trans = session.beginTransaction(); try { session.saveOrUpdate(escala); ...

20. Generate insert statements for backup    forum.hibernate.org

21. DDL generation listener    forum.hibernate.org

22. Problem with @Generated(GenerationTime.INSERT)    forum.hibernate.org

Hi All, I have an entity "User" that has a timestamp property "createdDate", which I would like to set as the current date when the entity is created, and never change again. I am using Hibernate 3.2.1 GA with a Java 6 compiler on a windows XP machine. Here is the relevant code: @Entity public class User { ... // An ...

23. Populate reference data from Hibernate after generating DDL?    forum.hibernate.org

Hibernate version: 3.2.0 Mapping documents: Annotations only Can someone suggest a strategy for populating reference data in unit tests where hibernate is used to generate the ddl? We use an in-memory database for our JUnit tests and we have an Entity which is read-only for which we need to have rows inserted into the table that Hibernate generates for us. Is ...

24. JPA auto generate DDL with ANT    forum.hibernate.org

25. Not cascading on insert and @Generated(Gen...) not inserting    forum.hibernate.org

Hibernate Community View topic - Not cascading on insert and @Generated(Gen...) not inserting Login Register FAQ Search View unanswered posts | View active topics Board index Hibernate & Java Persistence Hibernate Users All times are UTC - 5 hours [ DST ] Not cascading on insert and @Generated(Gen...) not inserting ...

26. Not cascading on insert and @Generated(Gen...) not inserting    forum.hibernate.org

Hibernate Community View topic - Not cascading on insert and @Generated(Gen...) not inserting Login Register FAQ Search View unanswered posts | View active topics Board index Hibernate & Java Persistence Hibernate Users All times are UTC - 5 hours [ DST ] Not cascading on insert and @Generated(Gen...) not inserting ...

27. Delta DDL generation    forum.hibernate.org

Hi. We are working with Hibernate and have come to a point where we need to plan for production and future releases. In our development environment we auto-generate the tables but this won't be done in production environment (as recommended). Generating DDL's from hibernate is no problem, but what struck us was that it will be difficult to maintain in the ...

28. Insert entity and id seqeunce generation    forum.hibernate.org

Hi, I want to do something like this: if entity has empty id while saving, hibernate should use seqnuence to generate, otherwise (id is not null) it should insert entity with filled id (not generated by sequence). The easiest approach is to create to second mapping files, but is there any alternate to do this. Best regards, Jakub Miszkurka

29. Changes after save() generates INSERT+UPDATE    forum.hibernate.org

I have noticed that the INSERT statement that Hibernate sends to the database always contains the values that were held by the object when Session.save() was called. This means that if the object changes after Session.save(), then another UPDATE will be issued (instead of combining the changes into one INSERT) Does anybody know whether it is possible to combine all changes ...

30. Reset Id's, generated by hibernate, if insert fails    forum.hibernate.org

Hi, i have the following problem: - user enters data into a form - form data is stored inside a java object - saveOrUpdate is called; now the insert of the new object fails due to a unique constraint violation - the user corrects his data and tries again to store the data The problem is, when saveOrUpdate is called again, ...