sql « Association « JPA Q&A





1. Why is it recommended to avoid unidirectional one-to-many association on a foreign key?    stackoverflow.com

In the Hibernate online documentation, under section 7.2.3 One-to-many, it's mentioned, that:

unidirectional one-to-many association on a foreign key is an unusual case, and is not recommended. You ...

2. Association best pattern    stackoverflow.com

I have a question about sql relation conception. I have a simple example. A table person, country and I want to record the history where person had lived.

CREATE TABLE person
(
   ...

3. delete association collection produces many sql    forum.hibernate.org

It's a parent/child association, and I set the mapping as "all, delete-orphan".When I delete the parent(session.delete(parent);), it produces many sql such as: delete from child where id=? delete from child where id=? ... delete from parent where id=? but my purpose is to use just 2 sql such as: delete from parent where id=? delete from child where parent_id=? How can ...

4. Native SQL vs. Associations    forum.hibernate.org

I have recently started using Hibernate and so far I love it. However I think that I might be using Hibernate in a butchered manner as many of the times I am resorting to native SQL because often I need to select specific columns, do multiple outer joins, and use aggregate functions to get the information that is to be sent ...

5. one-to-one association on a primary key & N+1 sql    forum.hibernate.org

Hi, I want to use one-to-one association on a primary key between some tables but when I've checked what kind of sgl is produce I've noticed that records from associated table are read during accessing main table. Some details: Hibernate version: 3.0 Mapping documents: MAIN TABLE

6. Wrong SQL generated when using many-to-one associations    forum.hibernate.org

Hi: I am having troubles (and a horrible headache) with several associations in my code. My system Hibernate version: 3.3 MySQL 5/ Oracle 10i The associations are all "many-to-one" and defined like this: Code: ...