hql « Table « JPA Q&A





1. Access many to many tables in HQL    coderanch.com

I am trying to access users that have a subset of from an interests table. The Interets and Users tables have a many to many relationship using a join table. The JDO's generated look like this (Simplified): public class DefInterests{ private Integer id; private String value; private Set userProfiles = new HashSet(0); } public class Users{ private Long id; private String ...

2. Comparing 2 tables HQL    forum.hibernate.org

3. How to create database table using hql    forum.hibernate.org

Version : 2.1.2 No problem with mapping files since they were created and tested using "from" and "select" statements. Database is : SQL Server 2000 code--(If I try to execute this query using createSQLQuery() method it neither gives any exception nor creates the table. If I try it use java.sql methods table does get created.) String CREATE_REPORT_TABLE = "begin " + ...

4. How To Create Table in HQL    forum.hibernate.org

Hi , How can we create Table in Hibernate Query Language without using XML mapping file or is there any mechanism through which we can create mapping file dynamically . Problem : I dont know the exact number of columns present the table since it will be based on user's request. In SQL we have CREATE Table command similarly do we ...

6. Does HQL refer to java classes or DB tables    forum.hibernate.org

I am new to Hibernate (ver 3.2.2GA). From my understanding of the manual, it seems a HQL statement should refer to the java classes that my table are mapped to. But in the manual the same names are used for classes and tables, so it is not always clear to me which is which. If I refer to the DB tables ...

7. Table name in HQL    forum.hibernate.org

Hello, I have this weird requirement where I may need to use table name in hwl. Is this possible or is there any work around? Specifics: 3 Tables: CREATE TABLE PERSON ( person_id int, user_id varchar(32), first_name varchar(128), last_name varchar(128) ); CREATE TABLE ADDRESS ( address_id int, unit_no varchar(8), addressLine1 varchar(128), city varchar(64) ); CREATE TABLE PERSON_ADDRESS_LINK ( person_address_link int, person_id ...

8. Table name in HQL    forum.hibernate.org

Hello, I have this weird requirement where I may need to use table name in hql. Is this possible or is there any work around? Specifics: 3 Tables: CREATE TABLE PERSON ( person_id int, user_id varchar(32), first_name varchar(128), last_name varchar(128) ); CREATE TABLE ADDRESS ( address_id int, unit_no varchar(8), addressLine1 varchar(128), city varchar(64) ); CREATE TABLE PERSON_ADDRESS_LINK ( person_address_link int, person_id ...

9. How to clear M:N link table with HQL?    forum.hibernate.org

Imaging that I have entities UserAccount and Role. There is a relation "roles" declared as: @ManyToMany() @JoinTable(...) Set UserAccount.getRoles(); void UserAccount.setRoles(Set roles); Now I have a requirement to bulk delete a set of accounts. However, before this I have to remove all associations UserAccount->Role for all accounts involved, otherwise ConstraintViolationException is thrown (obviously). I mean, that I have to remove only ...