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 <[email protected]> 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.