facebook

a jpa bug

  1. MyEclipse IDE
  2.  > 
  3. Java EE Development (EJB, JSP, Struts, XDoclet, etc.)
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #271040 Reply

    feili
    Member

    Hi,

    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.message

    look 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 failed

    #271088

    Loyal Water
    Member

    Hi 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.

    #271222

    Brian Fernandes
    Moderator

    Feili,

    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?

    #271256

    feili
    Member

    Hi,

    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

    #271301

    ernestz
    Member

    Coincidentally, 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.

    #271332

    feili
    Member

    Hi,

    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

    #271355

    ernestz
    Member

    When 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.

Viewing 7 posts - 1 through 7 (of 7 total)
Reply To: a jpa bug

You must be logged in to post in the forum log in