You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by anyz <an...@gmail.com> on 2010/05/31 13:00:53 UTC
Hibernate 3 Outer Join Problem
i'm trying to use hibernate 3 with Derby 10.6. Normal queries work good but
using left outer join creates problem. The query i'm trying loads project
program if it exists and if programm not exists the project information is
loaded:
SELECT proj, prog FROM Project
LEFT OUTER JOIN Program ON Program.programId = Project.programId
WHERE Project.projectName = '"MyProject"
The error on executing query is :
unexpected token: ON near line 1, column xxx [SELECT proj, prog, FROM
a.b.Project LEFT OUTER JOIN Program ON Program.programId = Project.programId
WHERE Project.projectName = 'MyProject' ]
at org.hibernate.hql.ast.QuerySyntax
Could you please guid if Hibernate dialect support for Derbby is not that
good of i'm missing something.
thanks
Re: Hibernate 3 Outer Join Problem
Posted by Lily Wei <li...@yahoo.com>.
Hi umpirsky:
I am not sure whether this will solve your problem.
However, will using two parameters work better?
For example:
String insertsql = "insert into testdbsize (name, address) values
(?,
?)";
PreparedStatement insertFirst = cs1.prepareStatement(insertsql,
Statement.RETURN_GENERATED_KEYS);
String name = new String("ABCD");
String address = new String("333 Glory Lily");
insertFirst.setString(1, name);
insertFirst.setString(2, address);
int result = insertFirst.executeUpdate();
if (result != 0) {
System.out.println("insert data to testdbsize");
}
ResultSet rs = insertFirst.getGeneratedKeys();
while (rs.next()) {
System.out.println("The generated key id is: " + rs.getInt(1));
}
rs.close();
insertFirst.close();
Also, does it matter if using column tag instead of "column name"
tag?
For example:
<id name="id" column="ID">
<generator class="increment"/>
</id>
Hope this help,
Lily
Re: Hibernate 3 Outer Join Problem
Posted by umpirsky <um...@gmail.com>.
Thanks for the fast answer!
After adding
public class Students implements java.io.Serializable {
@GeneratedValue
private int id;
private String name;
private String address;
...
it says:
WARNING: SQL Error: -1, SQLState: 42Z23
2010-07-26 12:50:48 org.hibernate.util.JDBCExceptionReporter logExceptions
SEVERE: Attempt to modify an identity column 'ID'.
2010-07-26 12:50:48 org.hibernate.event.def.AbstractFlushingEventListener
performExecutions
SEVERE: Could not synchronize database state with session
org.hibernate.exception.SQLGrammarException: could not insert:
[desktopapplication1.Students]
I have also added
<id name="id" type="int">
<column name="ID" />
<generator class="increment"/>
</id>
Chris Wilson-24 wrote:
>
> Hi Umpirsky,
>
> On Mon, 26 Jul 2010, umpirsky wrote:
>
>> Sorry for jumping in like this, but since you have expirience with
>> Hibernate and Derby, can you suggest any solution for working with
>> generated keys? I have problem with primary keys, if I ommit them on
>> insert, it fails, even if they are auto generated. Example table:
>>
>> CREATE TABLE students
>> (
>> id INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT
>> BY
>> 1),
>> name VARCHAR(24) NOT NULL,
>> address VARCHAR(1024),
>> CONSTRAINT primary_key PRIMARY KEY (id)
>> ) ;
>>
>> Code:
>>
>> Students s = new Students();
>> s.setName("Sasa");
>> s.setAddress("Ulica");
>> session.save(s);
>>
>> fails, because it generates SQL:
>>
>> insert into APP.STUDENTS (NAME, ADDRESS, ID) values (?, ?, ?)
>>
>> Any idea?
>
> It shouldn't do that IF:
>
> * You configure your ID column in your mapping as an appropriate
> auto-generated type. (@GeneratedValue or equivalent should work).
>
> * You use the correct dialect for Hibernate.
>
> Cheers, Chris.
> --
> Aptivate | http://www.aptivate.org | Phone: +44 1223 760887
> The Humanitarian Centre, Fenner's, Gresham Road, Cambridge CB1 2ES
>
> Aptivate is a not-for-profit company registered in England and Wales
> with company number 04980791.
>
>
--
View this message in context: http://old.nabble.com/Hibernate-3-Outer-Join-Problem-tp28729781p29265219.html
Sent from the Apache Derby Users mailing list archive at Nabble.com.
Re: Hibernate 3 Outer Join Problem
Posted by Chris Wilson <ch...@aptivate.org>.
Hi Umpirsky,
On Mon, 26 Jul 2010, umpirsky wrote:
> Sorry for jumping in like this, but since you have expirience with
> Hibernate and Derby, can you suggest any solution for working with
> generated keys? I have problem with primary keys, if I ommit them on
> insert, it fails, even if they are auto generated. Example table:
>
> CREATE TABLE students
> (
> id INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY
> 1),
> name VARCHAR(24) NOT NULL,
> address VARCHAR(1024),
> CONSTRAINT primary_key PRIMARY KEY (id)
> ) ;
>
> Code:
>
> Students s = new Students();
> s.setName("Sasa");
> s.setAddress("Ulica");
> session.save(s);
>
> fails, because it generates SQL:
>
> insert into APP.STUDENTS (NAME, ADDRESS, ID) values (?, ?, ?)
>
> Any idea?
It shouldn't do that IF:
* You configure your ID column in your mapping as an appropriate
auto-generated type. (@GeneratedValue or equivalent should work).
* You use the correct dialect for Hibernate.
Cheers, Chris.
--
Aptivate | http://www.aptivate.org | Phone: +44 1223 760887
The Humanitarian Centre, Fenner's, Gresham Road, Cambridge CB1 2ES
Aptivate is a not-for-profit company registered in England and Wales
with company number 04980791.
Re: Hibernate 3 Outer Join Problem
Posted by umpirsky <um...@gmail.com>.
Sorry for jumping in like this, but since you have expirience with Hibernate
and Derby, can you suggest any solution for working with generated keys? I
have problem with primary keys, if I ommit them on insert, it fails, even if
they are auto generated. Example table:
CREATE TABLE students
(
id INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY
1),
name VARCHAR(24) NOT NULL,
address VARCHAR(1024),
CONSTRAINT primary_key PRIMARY KEY (id)
) ;
Code:
Students s = new Students();
s.setName("Sasa");
s.setAddress("Ulica");
session.save(s);
fails, because it generates SQL:
insert into APP.STUDENTS (NAME, ADDRESS, ID) values (?, ?, ?)
Any idea?
Brett Wooldridge-2 wrote:
>
> This looks like a Hibernate error, not a Derby error. I've been using
> Hibernate 3 with Derby for a few years and never had any issues. Is this
> query generated by Hibernate? It seems like you are using HQL (the error
> is
> in org.hibernate.hql.ast.QuerySyntax) , but you are feeding it SQL syntax.
> HQL syntax is similar but not equal to SQL.
>
> Brett
>
>
> On Mon, May 31, 2010 at 8:00 PM, anyz <an...@gmail.com> wrote:
>
>> i'm trying to use hibernate 3 with Derby 10.6. Normal queries work good
>> but
>> using left outer join creates problem. The query i'm trying loads project
>> program if it exists and if programm not exists the project information
>> is
>> loaded:
>>
>> SELECT proj, prog FROM Project
>> LEFT OUTER JOIN Program ON Program.programId = Project.programId
>> WHERE Project.projectName = '"MyProject"
>>
>> The error on executing query is :
>>
>> unexpected token: ON near line 1, column xxx [SELECT proj, prog, FROM
>> a.b.Project LEFT OUTER JOIN Program ON Program.programId =
>> Project.programId
>> WHERE Project.projectName = 'MyProject' ]
>> at org.hibernate.hql.ast.QuerySyntax
>> Could you please guid if Hibernate dialect support for Derbby is not
>> that
>> good of i'm missing something.
>>
>> thanks
>>
>>
>
>
--
View this message in context: http://old.nabble.com/Hibernate-3-Outer-Join-Problem-tp28729781p29264997.html
Sent from the Apache Derby Users mailing list archive at Nabble.com.
Re: Hibernate 3 Outer Join Problem
Posted by anyz <an...@gmail.com>.
I used the same HQL sysntax for mySQL and it worked. Further Derby manuall
lists the same syntax for join.
On Mon, May 31, 2010 at 6:45 PM, Brett Wooldridge <
brett.wooldridge@gmail.com> wrote:
> This looks like a Hibernate error, not a Derby error. I've been using
> Hibernate 3 with Derby for a few years and never had any issues. Is this
> query generated by Hibernate? It seems like you are using HQL (the error is
> in org.hibernate.hql.ast.QuerySyntax) , but you are feeding it SQL syntax.
> HQL syntax is similar but not equal to SQL.
>
> Brett
>
>
> On Mon, May 31, 2010 at 8:00 PM, anyz <an...@gmail.com> wrote:
>
>> i'm trying to use hibernate 3 with Derby 10.6. Normal queries work good
>> but using left outer join creates problem. The query i'm trying loads
>> project program if it exists and if programm not exists the project
>> information is loaded:
>>
>> SELECT proj, prog FROM Project
>> LEFT OUTER JOIN Program ON Program.programId = Project.programId
>> WHERE Project.projectName = '"MyProject"
>>
>> The error on executing query is :
>>
>> unexpected token: ON near line 1, column xxx [SELECT proj, prog, FROM
>> a.b.Project LEFT OUTER JOIN Program ON Program.programId = Project.programId
>> WHERE Project.projectName = 'MyProject' ]
>> at org.hibernate.hql.ast.QuerySyntax
>> Could you please guid if Hibernate dialect support for Derbby is not that
>> good of i'm missing something.
>>
>> thanks
>>
>>
>
>
Re: Hibernate 3 Outer Join Problem
Posted by Brett Wooldridge <br...@gmail.com>.
This looks like a Hibernate error, not a Derby error. I've been using
Hibernate 3 with Derby for a few years and never had any issues. Is this
query generated by Hibernate? It seems like you are using HQL (the error is
in org.hibernate.hql.ast.QuerySyntax) , but you are feeding it SQL syntax.
HQL syntax is similar but not equal to SQL.
Brett
On Mon, May 31, 2010 at 8:00 PM, anyz <an...@gmail.com> wrote:
> i'm trying to use hibernate 3 with Derby 10.6. Normal queries work good but
> using left outer join creates problem. The query i'm trying loads project
> program if it exists and if programm not exists the project information is
> loaded:
>
> SELECT proj, prog FROM Project
> LEFT OUTER JOIN Program ON Program.programId = Project.programId
> WHERE Project.projectName = '"MyProject"
>
> The error on executing query is :
>
> unexpected token: ON near line 1, column xxx [SELECT proj, prog, FROM
> a.b.Project LEFT OUTER JOIN Program ON Program.programId = Project.programId
> WHERE Project.projectName = 'MyProject' ]
> at org.hibernate.hql.ast.QuerySyntax
> Could you please guid if Hibernate dialect support for Derbby is not that
> good of i'm missing something.
>
> thanks
>
>
Re: Hibernate 3 Outer Join Problem
Posted by Brett Wooldridge <br...@gmail.com>.
Hi anyz,
It seems to me that it is just luck that the mySQL dialect generated a
useable query. These are trivial tables (and I presume classes), but the
mapping seems incorrect to me. Without an explicit expresses relation
between Project and Program, it seems unlikely that Hibernate can reliably
process HQL (ie generate valid SQL).
I think programId in the Project mapping should be of type a.b.model.Program
not java.lang.Integer, and the relationship expresses as a join in the
mapping.
Anyway, I would suggest reading up on Hibernate mappings, and if you still
have trouble, ask over on the Hibernate forums. I am 99% sure there is
nothing wrong with the Derby dialect in this case.
Good luck.
Brett
Sent from my iPhone
On Jun 1, 2010, at 14:07, anyz <an...@gmail.com> wrote:
Thanks Brett for your time. Yes it is more of Hibernate issue i was just
trying to find if some of derby user encounter with this.
Here are tables structure and mapping.
CREATE TABLE PROJECT (
PROJECT_ID VARCHAR(50) NOT NULL,
PROJECT_NAME VARCHAR(150) NOT NULL,
PROJECT_MANAGER VARCHAR(150) NOT NULL,
START_DATE TIMESTAMP NOT NULL,
END_DATE TIMESTAMP NOT NULL,
PROGRAM_ID INTEGER,
PRIMARY KEY (PROJECT_ID)
);
ALTER TABLE PROJECT
ADD FOREIGN KEY (PROGRAM_ID)
REFERENCES PROGRAM (PROGRAM_ID);
CREATE TABLE PROGRAM (
PROGRAM_ID INTEGER DEFAULT AUTOINCREMENT: start 1 increment 1 NOT NULL,
PROGRAM_NAME VARCHAR(150) NOT NULL,
PROGRAM_MANAGER VARCHAR(150) NOT NULL,
PRIMARY KEY (PROGRAM_ID)
);
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD
3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="a.b.model.Project" table="PROJECT">
<id name="projectId" type="string">
<column name="PROJECT_ID" length="50" />
<generator class="assigned" />
</id>
<property name="projectName" type="string">
<column name="PROJECT_NAME" length="150" not-null="true" />
</property>
<property name="projectManager" type="string">
<column name="PROJECT_MANAGER" length="150" not-null="true" />
</property>
<property name="startDate" type="timestamp">
<column name="START_DATE" length="26" not-null="true" />
</property>
<property name="endDate" type="timestamp">
<column name="END_DATE" length="26" not-null="true" />
</property>
<property name="programId" type="java.lang.Integer">
<column name="PROGRAM_ID" />
</property>
</class>
</hibernate-mapping>
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD
3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="a.b.model.Program" table="PROGRAM">
<id name="programId" type="int">
<column name="PROGRAM_ID" />
<generator class="identity" />
</id>
<property name="programName" type="string">
<column name="PROGRAM_NAME" length="150" not-null="true" />
</property>
<property name="programManager" type="string">
<column name="PROGRAM_MANAGER" length="150" not-null="true" />
</property>
</class>
</hibernate-mapping>
Thanks once again.
On Mon, May 31, 2010 at 7:55 PM, Brett Wooldridge <
brett.wooldridge@gmail.com> wrote:
> When you say "Hibernate 3", what specific version are you talking about?
> While this is more of a Hibernate question than a Derby question, what is
> the structure of the two tables (for Project and Program) and what does the
> mapping look like?
>
> Brett
>
>
> On Mon, May 31, 2010 at 10:52 PM, anyz <an...@gmail.com> wrote:
>
>> Its seems to be hibernate issue. Dialect in hibernate 3 is not uptodate i
>> think.
>>
>> We tried it as below:
>>
>> SELECT proj, prog, FROM Project proj, Program prog
>>
>> but it didn't work.
>>
>>
>> On Mon, May 31, 2010 at 6:19 PM, Donald McLean <dm...@gmail.com>wrote:
>>
>>> Have you tried explicitly specifying the table? i.e. Project.proj
>>>
>>> On Mon, May 31, 2010 at 7:00 AM, anyz <an...@gmail.com> wrote:
>>> > i'm trying to use hibernate 3 with Derby 10.6. Normal queries work good
>>> but
>>> > using left outer join creates problem. The query i'm trying loads
>>> project
>>> > program if it exists and if programm not exists the project information
>>> is
>>> > loaded:
>>> >
>>> > SELECT proj, prog FROM Project
>>> > LEFT OUTER JOIN Program ON Program.programId = Project.programId
>>> > WHERE Project.projectName = '"MyProject"
>>> >
>>> > The error on executing query is :
>>> >
>>> > unexpected token: ON near line 1, column xxx [SELECT proj, prog, FROM
>>> > a.b.Project LEFT OUTER JOIN Program ON Program.programId =
>>> Project.programId
>>> > WHERE Project.projectName = 'MyProject' ]
>>> > at org.hibernate.hql.ast.QuerySyntax
>>> >
>>> > Could you please guid if Hibernate dialect support for Derbby is not
>>> that
>>> > good of i'm missing something.
>>> >
>>> > thanks
>>> >
>>>
>>>
>>>
>>> --
>>> Family photographs are a critical legacy for
>>> ourselves and our descendants. Protect that
>>> legacy with a digital backup and recovery plan.
>>>
>>> Join the photo preservation advocacy Facebook group:
>>> http://www.facebook.com/home.php?ref=logo#/group.php?gid=148274709288
>>>
>>
>>
>
Re: Hibernate 3 Outer Join Problem
Posted by anyz <an...@gmail.com>.
Thanks Brett for your time. Yes it is more of Hibernate issue i was just
trying to find if some of derby user encounter with this.
Here are tables structure and mapping.
CREATE TABLE PROJECT (
PROJECT_ID VARCHAR(50) NOT NULL,
PROJECT_NAME VARCHAR(150) NOT NULL,
PROJECT_MANAGER VARCHAR(150) NOT NULL,
START_DATE TIMESTAMP NOT NULL,
END_DATE TIMESTAMP NOT NULL,
PROGRAM_ID INTEGER,
PRIMARY KEY (PROJECT_ID)
);
ALTER TABLE PROJECT
ADD FOREIGN KEY (PROGRAM_ID)
REFERENCES PROGRAM (PROGRAM_ID);
CREATE TABLE PROGRAM (
PROGRAM_ID INTEGER DEFAULT AUTOINCREMENT: start 1 increment 1 NOT NULL,
PROGRAM_NAME VARCHAR(150) NOT NULL,
PROGRAM_MANAGER VARCHAR(150) NOT NULL,
PRIMARY KEY (PROGRAM_ID)
);
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD
3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="a.b.model.Project" table="PROJECT">
<id name="projectId" type="string">
<column name="PROJECT_ID" length="50" />
<generator class="assigned" />
</id>
<property name="projectName" type="string">
<column name="PROJECT_NAME" length="150" not-null="true" />
</property>
<property name="projectManager" type="string">
<column name="PROJECT_MANAGER" length="150" not-null="true" />
</property>
<property name="startDate" type="timestamp">
<column name="START_DATE" length="26" not-null="true" />
</property>
<property name="endDate" type="timestamp">
<column name="END_DATE" length="26" not-null="true" />
</property>
<property name="programId" type="java.lang.Integer">
<column name="PROGRAM_ID" />
</property>
</class>
</hibernate-mapping>
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD
3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="a.b.model.Program" table="PROGRAM">
<id name="programId" type="int">
<column name="PROGRAM_ID" />
<generator class="identity" />
</id>
<property name="programName" type="string">
<column name="PROGRAM_NAME" length="150" not-null="true" />
</property>
<property name="programManager" type="string">
<column name="PROGRAM_MANAGER" length="150" not-null="true" />
</property>
</class>
</hibernate-mapping>
Thanks once again.
On Mon, May 31, 2010 at 7:55 PM, Brett Wooldridge <
brett.wooldridge@gmail.com> wrote:
> When you say "Hibernate 3", what specific version are you talking about?
> While this is more of a Hibernate question than a Derby question, what is
> the structure of the two tables (for Project and Program) and what does the
> mapping look like?
>
> Brett
>
>
> On Mon, May 31, 2010 at 10:52 PM, anyz <an...@gmail.com> wrote:
>
>> Its seems to be hibernate issue. Dialect in hibernate 3 is not uptodate i
>> think.
>>
>> We tried it as below:
>>
>> SELECT proj, prog, FROM Project proj, Program prog
>>
>> but it didn't work.
>>
>>
>> On Mon, May 31, 2010 at 6:19 PM, Donald McLean <dm...@gmail.com>wrote:
>>
>>> Have you tried explicitly specifying the table? i.e. Project.proj
>>>
>>> On Mon, May 31, 2010 at 7:00 AM, anyz <an...@gmail.com> wrote:
>>> > i'm trying to use hibernate 3 with Derby 10.6. Normal queries work good
>>> but
>>> > using left outer join creates problem. The query i'm trying loads
>>> project
>>> > program if it exists and if programm not exists the project information
>>> is
>>> > loaded:
>>> >
>>> > SELECT proj, prog FROM Project
>>> > LEFT OUTER JOIN Program ON Program.programId = Project.programId
>>> > WHERE Project.projectName = '"MyProject"
>>> >
>>> > The error on executing query is :
>>> >
>>> > unexpected token: ON near line 1, column xxx [SELECT proj, prog, FROM
>>> > a.b.Project LEFT OUTER JOIN Program ON Program.programId =
>>> Project.programId
>>> > WHERE Project.projectName = 'MyProject' ]
>>> > at org.hibernate.hql.ast.QuerySyntax
>>> >
>>> > Could you please guid if Hibernate dialect support for Derbby is not
>>> that
>>> > good of i'm missing something.
>>> >
>>> > thanks
>>> >
>>>
>>>
>>>
>>> --
>>> Family photographs are a critical legacy for
>>> ourselves and our descendants. Protect that
>>> legacy with a digital backup and recovery plan.
>>>
>>> Join the photo preservation advocacy Facebook group:
>>> http://www.facebook.com/home.php?ref=logo#/group.php?gid=148274709288
>>>
>>
>>
>
Re: Hibernate 3 Outer Join Problem
Posted by Brett Wooldridge <br...@gmail.com>.
When you say "Hibernate 3", what specific version are you talking about?
While this is more of a Hibernate question than a Derby question, what is
the structure of the two tables (for Project and Program) and what does the
mapping look like?
Brett
On Mon, May 31, 2010 at 10:52 PM, anyz <an...@gmail.com> wrote:
> Its seems to be hibernate issue. Dialect in hibernate 3 is not uptodate i
> think.
>
> We tried it as below:
>
> SELECT proj, prog, FROM Project proj, Program prog
>
> but it didn't work.
>
>
> On Mon, May 31, 2010 at 6:19 PM, Donald McLean <dm...@gmail.com>wrote:
>
>> Have you tried explicitly specifying the table? i.e. Project.proj
>>
>> On Mon, May 31, 2010 at 7:00 AM, anyz <an...@gmail.com> wrote:
>> > i'm trying to use hibernate 3 with Derby 10.6. Normal queries work good
>> but
>> > using left outer join creates problem. The query i'm trying loads
>> project
>> > program if it exists and if programm not exists the project information
>> is
>> > loaded:
>> >
>> > SELECT proj, prog FROM Project
>> > LEFT OUTER JOIN Program ON Program.programId = Project.programId
>> > WHERE Project.projectName = '"MyProject"
>> >
>> > The error on executing query is :
>> >
>> > unexpected token: ON near line 1, column xxx [SELECT proj, prog, FROM
>> > a.b.Project LEFT OUTER JOIN Program ON Program.programId =
>> Project.programId
>> > WHERE Project.projectName = 'MyProject' ]
>> > at org.hibernate.hql.ast.QuerySyntax
>> >
>> > Could you please guid if Hibernate dialect support for Derbby is not
>> that
>> > good of i'm missing something.
>> >
>> > thanks
>> >
>>
>>
>>
>> --
>> Family photographs are a critical legacy for
>> ourselves and our descendants. Protect that
>> legacy with a digital backup and recovery plan.
>>
>> Join the photo preservation advocacy Facebook group:
>> http://www.facebook.com/home.php?ref=logo#/group.php?gid=148274709288
>>
>
>
Re: Hibernate 3 Outer Join Problem
Posted by anyz <an...@gmail.com>.
Its seems to be hibernate issue. Dialect in hibernate 3 is not uptodate i
think.
We tried it as below:
SELECT proj, prog, FROM Project proj, Program prog
but it didn't work.
On Mon, May 31, 2010 at 6:19 PM, Donald McLean <dm...@gmail.com> wrote:
> Have you tried explicitly specifying the table? i.e. Project.proj
>
> On Mon, May 31, 2010 at 7:00 AM, anyz <an...@gmail.com> wrote:
> > i'm trying to use hibernate 3 with Derby 10.6. Normal queries work good
> but
> > using left outer join creates problem. The query i'm trying loads project
> > program if it exists and if programm not exists the project information
> is
> > loaded:
> >
> > SELECT proj, prog FROM Project
> > LEFT OUTER JOIN Program ON Program.programId = Project.programId
> > WHERE Project.projectName = '"MyProject"
> >
> > The error on executing query is :
> >
> > unexpected token: ON near line 1, column xxx [SELECT proj, prog, FROM
> > a.b.Project LEFT OUTER JOIN Program ON Program.programId =
> Project.programId
> > WHERE Project.projectName = 'MyProject' ]
> > at org.hibernate.hql.ast.QuerySyntax
> >
> > Could you please guid if Hibernate dialect support for Derbby is not that
> > good of i'm missing something.
> >
> > thanks
> >
>
>
>
> --
> Family photographs are a critical legacy for
> ourselves and our descendants. Protect that
> legacy with a digital backup and recovery plan.
>
> Join the photo preservation advocacy Facebook group:
> http://www.facebook.com/home.php?ref=logo#/group.php?gid=148274709288
>
Re: Hibernate 3 Outer Join Problem
Posted by Donald McLean <dm...@gmail.com>.
Have you tried explicitly specifying the table? i.e. Project.proj
On Mon, May 31, 2010 at 7:00 AM, anyz <an...@gmail.com> wrote:
> i'm trying to use hibernate 3 with Derby 10.6. Normal queries work good but
> using left outer join creates problem. The query i'm trying loads project
> program if it exists and if programm not exists the project information is
> loaded:
>
> SELECT proj, prog FROM Project
> LEFT OUTER JOIN Program ON Program.programId = Project.programId
> WHERE Project.projectName = '"MyProject"
>
> The error on executing query is :
>
> unexpected token: ON near line 1, column xxx [SELECT proj, prog, FROM
> a.b.Project LEFT OUTER JOIN Program ON Program.programId = Project.programId
> WHERE Project.projectName = 'MyProject' ]
> at org.hibernate.hql.ast.QuerySyntax
>
> Could you please guid if Hibernate dialect support for Derbby is not that
> good of i'm missing something.
>
> thanks
>
--
Family photographs are a critical legacy for
ourselves and our descendants. Protect that
legacy with a digital backup and recovery plan.
Join the photo preservation advocacy Facebook group:
http://www.facebook.com/home.php?ref=logo#/group.php?gid=148274709288