row « ID « JPA Q&A





1. Compisit-ID returning the same data in every row.    forum.hibernate.org

This is my first try with Composit keys. I am workoing with a legacy database and for this table, the fields OBDATE, OBKEYNBR, and OBSEQ make up a unque key. When I loop through the list, every item has the same data? It is always the first item in the record set. Am I missing something? My hbm.xml file...

2. Using MAX(id)+1 for new row's primary key    forum.hibernate.org

Hello. Since "increment" is a in-memory generator (hence, not recommended for cluster environments), I'm trying to figure out if hibernate can do a SELECT MAX(id)+1 type generation of the id fields? Our primary keys aren't setup with SEQUENCE, so I have to do this myself in the app code. Other than do it manually in the Java code, is there anyway ...

3. Save row with new ID    forum.hibernate.org

Hibernate version: 2.1.8 I need to load a row from the database and save a copy of it under a new id. The class is configured with a sequence, and that part works fine when I have a new object. Widget data = (Widget) session.get(Widget.class, id); data.setId(null); session.saveOrUpdate(data); session.flush(); When I do this I'm getting the following exception: net.sf.hibernate.HibernateException: identifier of ...

4. How to get DB generated Id for persisting rows in linking ta    forum.hibernate.org

Hibernate version: 3.2.2 Name and version of the database you are using: MySQL 5.0.38 There are table A with PK column idA and table B with PK column idB. The cardinality between table A and B is ManyToMany so that I created table C with PK(idA, idB) as linking table for table A and B. There are also two additional columns ...

5. problems with row name called "id"    forum.hibernate.org

hi there! first, sorry for my poor english. i am working with MySQL 5 and Hibernate 3.2 with annotations. i have one table like this: DROP TABLE IF EXISTS regla_condicion; create table regla_condicion( id_regla_condicion int not null auto_increment primary key, id_regla_facturacion int not null, id_metadato int not null, id int not null, foreign key (id_regla_facturacion) REFERENCES regla_facturacion (id_regla_facturacion), foreign key (id_metadato) ...