ID « Fetch « JPA Q&A





1. Getting related object's ID without fetching it from the database (Play framework)    stackoverflow.com

Say I have these two models:

public class City extends Model
{
    @ManyToOne
    private Country country;
}

public class Country extends Model
{
}
I have a City object and want to ...

2. how to retrieve ID after object store into database    stackoverflow.com

I am using Java, spring, jpa for our application. I want to retrieve Id of insert row. Basically our ID is generated at the time of storing object into database.

RoleRequest role ...

3. fetch of a removed entity by natural id, with caching fails    forum.hibernate.org

Hi I am using hibernate with EHCache. I have removed a persisted entity using entityManager.remove(persistedEntity). In a later step, i want to add a new entity with the same natural id as the removed one. Before doing that, i am fetching any entity with that natural id to make sure that there is no such entity in the database : Criteria ...

4. Retrieve id with sql server 2k    forum.hibernate.org

5. Always fetching ID even though lazy is true?    forum.hibernate.org

It's not that big of a deal but still, i've got a small problem: For example: I've got a many-to-one association, which has lazy="no-proxy" mapped. Now when I load this through a session createQuery, i see in the sql log files that the many-to-one his ID is fetched. Why is this? Is it possible to ignore this? I've got a table ...

6. one-to-one id without fetching    forum.hibernate.org

Hi: I've got two related classes as shown here: Employee ------> Photograph Every employee has got a photo. It's a one-to-one association set to "Fetch.LAZY", because I don't want the photograph to be retrieved every time I get information about an employee. Sometimes I need an employee's photo id (or null, if none), but I still don't want to retrieve the ...