Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Question regarding odd behavior of EclipseLink with Derby

Hi Gopi,

From what I can see, Derby and PostgreSQL are succeeding at running exactly the same SQL. Derby simply runs code after the successful code that causes the failure.

Can you please post the code you are running in both environments? When I look at the logs, I see a successful INSERT - perhaps the result of your persist. After the insert, the transaction commits, and more SQL is run. Are you running some queries? ("Service.countServicesAtEndpoint", "Service.getServicesAtEndpoint") What do those queries do? What code is run around the times when those queries are run? What happens after those queries are run (is there something that modifies an object and either does a flush of a commit?



-Tom

Gopi Kandaswamy wrote:
Hi Tom,

Thank you for your help. Please find attached two files; one with the derby logs (derby-log.txt) and the other with the postgresql logs (postgres-log.txt). As I had mentioned before, the problem occurs when I try to persist the 'Service' object and so I have included the logs for just that. As you can see the persist operation works fine in postgresql but fails in derby.

Note: 1. The relation between Service (maps to table called physical_endpoints) and Endpoint (maps to table logical_endpoints) is of type 'many-to-one' as specified in the orm.xml.
2. I have attached the relevant portions of my pom.xml file (pom.xml) to tell you which versions of what libraries I am using.

Thank you very much in advance.

Gopi



------------------------------------------------------------------------



------------------------------------------------------------------------



------------------------------------------------------------------------



On Jan 20, 2010, at 7:09 AM, Tom Ware wrote:

Hi Gopi,

 Could you turn on logging and send the logged SQL from both your Derby and PostGreSQL test cases?  (persistence unit property: eclipselink.logging.level=FINEST)

 Please also include the full stack trace from the exception in Derby.

-Tom

Gopi Kandaswamy wrote:
Hi all,
I am using EclipseLink 2.1.0 and when I run my code against a Derby database, I get the following error message. Basically this is what is happening...
a) I have a class called 'Service' (maps to database table called physical_endpoints) which has a many-to-one relationship to a database table called logical_endpoints. So the orm.xml for physical_endpoints looks like this...
<entity class="Service">
	<table name="physical_endpoints" />
	<attributes>
	.
	.
	.	
	<many-to-one name="endpoint">
      	<join-column name="logical_id" />
	</many-to-one>
      </attributes>
</entity>
As you can see, I have specified a <join-column name="logical_id">. I have not specified a <join-table name="the_join_table_name"> because such a join table does not exist and I do not want such a table to be created automatically by JPA. But when I run my code, EclipseLink tries to insert records into the join table for the above relationship. The join table for the above relation does not exist and hence the error below. The weird thing here is that when I use PostgreSQL database instead of Derby database, the following exception does not occur. In other words, the error occurs when I use EclipseLink + Derby and not EclipseLink + PostgreSQL.
Does anyone have any ideas? The error below occurs when I persists (em.persist(service)) to the database.
Thanks
Gopi
=======Exception=========
Internal Exception: java.sql.SQLSyntaxErrorException: Table/View 'LOGICAL_ENDPOINTS_PHYSICAL_ENDPOINTS' does not exist.
Error Code: 20000
Call: INSERT INTO logical_endpoints_physical_endpoints (services_id, Endpoint_id) VALUES (?, ?)
	bind => [1, 1]
Query: DataModifyQuery(sql="INSERT INTO logical_endpoints_physical_endpoints (services_id, Endpoint_id) VALUES (?, ?)")
=========================_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users


------------------------------------------------------------------------

_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users


Back to the top