Topic
  • 2 replies
  • Latest Post - ‏2011-09-01T09:30:58Z by FQE3_Ayal_Leibowitz
FQE3_Ayal_Leibowitz
FQE3_Ayal_Leibowitz
2 Posts

Pinned topic Hibernate + Websphere 7 strange problem

‏2011-08-31T06:08:22Z |
Hello, I am using Hibernate 3.6.5 as my persistence vendor and I'm facing a very strange problem. Now, I know Hibernate is not supported by IBM, but it seems to be a Websphere problem.

The server I'm using is Websphere 7.0.0.13 with JPA 2 feature-pack version 1.0.0.3, and I configured the server to use parent-last class loader as the IBM JPA documentation stated. The DB server is MS SQL-Server 2008.

Deployment goes fine, and here is the tricky part: On one Websphere I get an exception: QuerySyntaxException: Entity is not mapped SELECT a FROM Entity a WHERE a.Id = :Id

On another Websphere, with exactly the same specs, exactly the same installation process, exaclty same computer model, exactly the same ear file.. all goes well - no exception and persistence is working great.

I compared the drivers (SQLJDBC4), all the paths, the data-sources settings, even tried the same DB - nothing.

I have no clue... There has to be a difference...
Please help.

Best regards.
Updated on 2011-09-01T09:30:58Z at 2011-09-01T09:30:58Z by FQE3_Ayal_Leibowitz
  • sutter
    sutter
    94 Posts

    Re: Hibernate + Websphere 7 strange problem

    ‏2011-08-31T13:21:05Z  
    Hi,
    The exception you posted seems to be coming from Hibernate (vs OpenJPA), so I think your configuration for the Hibernate JPA provider seems to be working as expected.

    As far as the specific exception you are getting, I've read where Hibernate can get confused on the classes being referenced in the queries. There seems to be a couple of workarounds. One is to fully qualify the Entity class name in the query:

    SELECT a FROM my.package.Entity a WHERE a.Id = :Id

    The other is to specify the Entity class name in your persistence.xml file:

    <class>my.package.Entity<\class>

    Since it does look like the Hibernate JPA provider is being used, the problem does seem to be with the Hibernate provider. Try the above workarounds to see if they help with your situation. In either case, please post back with your findings.

    Thanks,
    Kevin Sutter, JPA Architect, IBM WebSphere
  • FQE3_Ayal_Leibowitz
    FQE3_Ayal_Leibowitz
    2 Posts

    Re: Hibernate + Websphere 7 strange problem

    ‏2011-09-01T09:30:58Z  
    • sutter
    • ‏2011-08-31T13:21:05Z
    Hi,
    The exception you posted seems to be coming from Hibernate (vs OpenJPA), so I think your configuration for the Hibernate JPA provider seems to be working as expected.

    As far as the specific exception you are getting, I've read where Hibernate can get confused on the classes being referenced in the queries. There seems to be a couple of workarounds. One is to fully qualify the Entity class name in the query:

    SELECT a FROM my.package.Entity a WHERE a.Id = :Id

    The other is to specify the Entity class name in your persistence.xml file:

    <class>my.package.Entity<\class>

    Since it does look like the Hibernate JPA provider is being used, the problem does seem to be with the Hibernate provider. Try the above workarounds to see if they help with your situation. In either case, please post back with your findings.

    Thanks,
    Kevin Sutter, JPA Architect, IBM WebSphere
    Thank you Kevin..

    unfortunately, I don't think it is a Hibernate problem.

    First, on one websphere, all works well and on another Websphere it doesn't.
    Second, on another application server (Glassfish 3.1) with exactly the same ear file and exactly the same DB, app works well - persistence, reading, everything works great. Several trying.

    If it is a Hibernate problem, I guess it shouldn't work at all cases, not only at a specific Webspheres.

    After a beat more research... I created a new profile on the Webspehre with the exception, and configured the profile from scratch - all worked fine, meaning: profile 1 - fails and profile 2 on the same server works fine. That made me think there is a problem with the JDBC4 drivers so I tried to reconfigure the other profile too - it didn't work.

    Maybe it has something to do with the augmentation of the profile by JPA pack.
    Maybe I did something wrong?

    This is the script:
    manageprofiles.bat -augment -templatePath "APP-SERVER-ROOT-FOLDER\profileTemplates\JPA\default.jpafep" -profileName "AppSrv01" -wbeHome "APP-SERVER-ROOT-FOLDER"

    Is there a way to compare the configuraitons between two Webspheres.... XML file or something?

    Thank you.