entity « ID « JPA Q&A





1. Using entity id as a reference in Hibernate    stackoverflow.com

I would like to hold a ref of some other entity using its identifier. The object model which I am working on is huge and related entities hold lot of data. ...

2. JPA entity without id    stackoverflow.com

I have database with next structure:

CREATE TABLE entity (
    id SERIAL,
    name VARCHAR(255),
    PRIMARY KEY (id)
);

CREATE TABLE entity_property (
    ...

3. JPA get id of entity object    stackoverflow.com

Does anyone know how I can do the equivalent of this in hibernate:

session.getIdentifier(instance);
with JPA? EntityManager has a contains method but that's pretty much it! I'm writing some code that acts as a transformer ...

4. I can replicate an entity keeping the original id in Hibernate?    stackoverflow.com

I need to persist an object with the replicate method of hibernate's session, but i want the object to retain its id, because it's an identity column in sql ...

5. How do I get id of merged JPA entity    stackoverflow.com

I have a little application where I store entity to DB. I do this in next way:

class Entity {
    privete id;
    String somePropertie;
   ...

6. The id of entity isn't id of the table    forum.hibernate.org

Hello, I would like to have your advice about something. First, details on my environment : I use Hibernate 3.2.6.ga and ehcache 1.4.1. I have a class with a generated id. But my application uses a unique property to search the entities and I would like to use ehcache according this unique property. So, the solution I've found is to set ...

8. how to use hibernate impl classes to get the id of an entity    forum.hibernate.org

I have this Object fetchIdFromBean(Object entity); The entity passed in may be an Object or a hibernate proxy with just an id inside. I am writing an ETL transformation layer on an existing hibernate layer. Is there a method in hibernate somewhere I can call that will return the id back for me? thanks, Dean

9. get the generated id from entity    forum.hibernate.org

hi all ! i have an entity with generated id by sequence (ORACLE) when i perform session.merge , the new value is generated in the DB but it does not appear in the id attribute of the entity. i need to read the new generated value because i load the screen with the new record value. how can i get the ...





10. Domain Design: Entities vs. Ids    forum.hibernate.org

Hi all, I have one question related to domain model design. I have one entity Order, which has references to some master data entities like Currency and Country: @Entity @Table( name = "ORDERS" ) public class Order { . @Column ( name = "CURRENCY_ID" ) private Currency currency; @Column ( name = "COUNTRY_ID" ) private Country country; . } I have ...

11. Using an entity id not the entity as a reference    forum.hibernate.org

I have a folder hierarchy I am mapping. A Folder contains Items, mapped as a list of ItemBeans. A Folder is a subclass of an Item. An Item has a reference to the folder it is in, hopefully mapped by parent_id column. I want the itemBean to contain the id of the parent, not the parentBean, to help break circular reference ...

12. Two id in one entity not working    forum.hibernate.org

I got problem when having two id in one entity. I have an Order entity. It has one "id" field, which is PK and is generated by Hibernate uuid. It also has a "refNum" field, which is a unique number for other business purpose and is generated by Oracle sequence. The "id" field is working fine. But, the "refNum" field is ...