- This topic has 6 replies, 4 voices, and was last updated 18 years, 1 month ago by
ernestz.
-
AuthorPosts
-
feiliMemberHi,
found a bug for you in JPA.
I have a database test, and a chema dbo, and a table message.
your db browser is correct to address it by:
test.dbo.message
JPA mapping is also OK:
@Table(name = “message”, schema = “dbo”, catalog = “test”, uniqueConstraints = {})But you jpa code is wrong to address it by:
dbo.test.messagelook at the error message below:
Jun 3, 2007 10:57:02 AM com.gis.jpa.test1.EntityManagerHelper log
INFO: finding Message instance with id: 1
[TopLink Info]: 2007.06.03 10:57:03.421–ServerSession(32019423)–TopLink, version: Oracle TopLink Essentials – 2.0 (Build b40-rc (03/21/2007))
[TopLink Info]: 2007.06.03 10:57:03.750–ServerSession(32019423)–file:/C:/Documents%20and%20Settings/feili/workspace/SimpleJPA/bin/-SimpleJPA login successful
[TopLink Warning]: 2007.06.03 10:57:03.890–UnitOfWork(24166053)–Exception [TOPLINK-4002] (Oracle TopLink Essentials – 2.0 (Build b40-rc (03/21/2007))): oracle.toplink.essentials.exceptions.DatabaseException
Internal Exception: com.microsoft.sqlserver.jdbc.SQLServerException: Invalid object name ‘dbo.test.message’.
Error Code: 208
Call: SELECT ID, msg FROM dbo.test.message WHERE (ID = ?)
bind => [1]
Query: ReadObjectQuery(com.gis.jpa.test1.Message)
Jun 3, 2007 10:57:03 AM com.gis.jpa.test1.EntityManagerHelper log
SEVERE: find failedJune 4, 2007 at 12:10 pm #271088
Loyal WaterMemberHi feili,
I have asked a person from my dev team to take a look into this issue. He will file this as bug incase it exists.Thanks.
June 7, 2007 at 2:08 am #271222
Brian FernandesModeratorFeili,
I apologize for the delayed response. The code generated by MyEclipse seems correct as it marks the catalog as “test” and the schema as “dbo” and not the other way around.
The code generated in our DAOs for the find method would refer to the Entity Java Class (Message in your case) without making references to either the catalog or the schema – this translation is the responsibility of the persistence provider – Toplink Essentials.
It seems like toplink has incorrectly generated the qualified name for your table, which is definitely surprising. I have not had the chance to confirm this yet so I could be mistaken, have you been able to fix this in anyway?
June 7, 2007 at 6:14 pm #271256
feiliMemberHi,
The problem occured between call for some Toplink methods. I guess your developer did not call correctly. You JPA tutorial is based on Derby database. If I look at the database that the tutorial used it dose not have schema layer at all. I suggest your team developer use some rigious database to do their job.
Thanks
Fei Li
June 8, 2007 at 10:21 am #271301
ernestzMemberCoincidentally, I just went through your JPA tutorial this morning. Then I tried to create a sample JPA application, utilizing an existing MS SQL Server database, only to encounter the same problem with the object not found message.
When I created the project and added JPA capabilities, I left the default as the toplink provider. How do I go about changing this to the hibernate provider? Do I have to manually edit the persistence.xml file? The only other way I see to do it via GUI is to delete the project and start over.
June 8, 2007 at 5:57 pm #271332
feiliMemberHi,
You are talking about 2 seperate things. The first thing is a JPA bug as I reported before. The second thing to choose JPA Mapping provider. When you add JPA capability to the project, the pop up window let you choose the JPA provider among 2 or 3. I do not remember there is hibernate. Please do not confuse JPA and Hibernate. JPA is actually Sun’s version of Hibernate. I think to choose Oracle’s TopLink is the best choice. I believe the wrong is on MyEclipse side not on JPA provider side. So choosing another provider should not solve any problem.
Regards
Fei Li
June 11, 2007 at 8:10 am #271355
ernestzMemberWhen you Add JPA Capabilities to a project, I can choose between two “Persistence Providers”, one being Toplink and the other is Hibernate.
If I choose Toplink, I see the problem you described (the table name incorrectly generated as dbo.test.message). If I create another project and select “Hibernate” as the provider, I do not see this problem.
-
AuthorPosts