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 Kristian Waagan <Kr...@Sun.COM> on 2009/08/03 10:53:41 UTC
Re: Bug : Derby table invisible from JPA provider
Brieuc Desoutter wrote:
> Hi,
>
> I'm learning JPA from the book Pro EJB 3 : Java Persistence API.
Hello Brieuc,
I'm not very familiar with JPA. Do you know if the JPA providers quote
your table names?
Would it be hard for you to enable statement text logging in Derby and
rerun the table creation and the failing SELECT statement?
This can be done with the property
"derby.language.logStatementText=true". Set it either as a system
property or in derby.properties. We may be able to find some relevant
output in derby.log now.
Also, what's the output from ij when running 'show tables;' after you
have run the data initialization script?
If this exercise shows that everything seem fine, is it hard to provide
a running repro that demonstrates the error?
Regards,
--
Kristian
>
> For the following mapping from chapter 4 :
> Employee (*) <------> (0..1) Department
>
> I have the following annotation :
>
> @Entity
> @Table( name="emp", schema="APP" )
> public class Employee {
>
> @ManyToOne
> @JoinColumn( name="dept_id" )
> private Department department;
>
> [...]
> }
>
> @Entity
> @Table( name="dept", schema="APP" )
> public class Department {
>
> @OneToMany( mappedBy="department" )
> private Collection<Employee> employees;
>
> [...]
> }
>
> Tables are created before-hand with an sql script executed from ij as
> shown in the derby_db_creation.txt file attached.
>
>
>
> The Many-to-one mapping from Employee to Department works fine but
> then the inverse relationship does not work correctly : the JPA
> provider ( toplink ) complains that it can't find the table APP.DEPT
> as shown in the attached file exception_stack_trace.txt
>
>
>
> I check with another JPA provider ( OpenJPA ) and got the same problem
> as shown in openJPA_exception.txt
>
>
>
> I did some more tests using another DB ( MySQL ) to verify my
> annotations and tables.
> I created the tables in MySQL using the same script and run the same
> test with both toplink and openJPA as JPA providers ( I had to remove
> the schema attribue of the @Table annotation which is required for
> Derby ) and everthing works fine.
>
> I've also attached my persistence.xml file
>
>
>
> Thanks for your help.
>
> Regards
>
> Brieuc
>
>
>
>