sql « Relationship « JPA Q&A





1. Hibernate: one-to-many relationship with no foreign key    stackoverflow.com

I am looking to map two tables that have no foreign key relationship as a one-to-many mapping. The relationship itself is computed using Native SQL. I am using the <loader query-ref> ...

2. one-to many relationship(HQL-SQL generation)    coderanch.com

I am trying execute join on using HQL. The background is: I have 2 tables ERROR_HIST and DEVICE_READINGS, where DEVICE_READING KEY is a foriegn key in ERROR_HIST and primary key in DEVICE_READINGS. It is one-many relationship between DEVICE_READING and ERROR_HIST My sql is : select eh.* from error_hist eh,device_readings dr where eh.DEVICE_READING_KEY=dr.DEVICE_READING_KEY AND dr.BRAND_NAME="ZEROX" AND dr.SERIAL_NUMBER="CDFDF" AND dr.MODEL_NUMBER="EA1010" In HQL I ...

3. Strange SQL output with a many-to-many relationship    forum.hibernate.org

hello everyone, I'm quite new to Hibernate and I'm currently stuck on trying to achieve something that apears to be rather simple: I can successfully get a bidirectional relationship between different kinds of objects but not when it involves 'joined-subclasses'. Here is a description of the setup. On one end I have 3 concrete classes (called classAAA, classAAB, classAAC). All of ...

4. criteria generate bad sql on multiple N:M relationships    forum.hibernate.org

Hi all I found a problem in java with Hibernate 3 and Oracle 10g related to queries built on multiple N:M relationships, when the corresponding join tables have columns with the same name. It seems that the Criteria class generates SQL code that Oracle rejects with an exception of type "ORA-00918: column ambiguously defined". This is because Hibernate adds on the ...

5. Avoid making more sql for one-to-many relationship    forum.hibernate.org

Hibernate version: 2.1.1 Hi all The project I am working needs to minimises the number of SQL queries to genereted to the database since the performance of the program will be serious degraded if more sql get genereted to the database. I have a product table that has one-to-many relationship with the color table. When I make a query to retrieve ...

6. one-to-one-or-zero relationship causing many extra sql calls    forum.hibernate.org

I am using 3.1.3, but I think this happens with 3.2 also. I created a one-to-one-or-zero relationship something like this: At first glance, it works fine in that it does join with the parent class, I get no errors, objects without notes have the field nulled and so on. The ...