foreign key « Load « JPA Q&A

1. Lazy loading problem with one to one mapping

I have 2 very simple POJOs and i have just one to one mapping between them.

  2. -- it has foreign key column to the
the code i have written is below.

@OneToOne(optional= ...

2. Setting foreign key values without loading the class

When you have an annotated class and you build a record (of that class) for insert and it has several foreign keys the records of which already exist ... how do you insert the proper values into the annotated class? Example: Table A pk_a fld1_a fld2_a Table B pk_b fld1_b Table C pk_c fk_a fk_b My java class for Table C ...

4. Limit on depth of foreign key object loading

5. no lazy loading for foreign-key based to-one associations

Hello, I'll give this another try, as it is really crucial, and I havent found a solution in any of the docs I can access (HTML reference, HIA book): I have 2 classes A and B that are related through a one-to-one association, which is mapped to a foreign key belonging to B's table. I am doing a query that retreives ...