• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

Strange behavior with Hibernate

Ranch Hand
Posts: 532
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I have been developing in one database with no problem. The configuration line is:

<property name="hibernate.connection.url">jdbc:sqlserver://DEVD1;DatabaseName=myProject;SelectMethod=direct</property>

The sql statement generated always append the database name to the SQL query like this: myProject.dbo.<table name>

So, far no problem.

Now: I tried to point the mapping file to different instance for testing. The new configuration file is like this:

<property name="hibernate.connection.url">jdbc:sqlserver://DEVD2;DatabaseName=myProjectTest;SelectMethod=direct</property>

Now, notice the difference. The database name changed to myProjectTest, and the sql server changed to DEVD2

When I try to connect to this database, I get a lot of errors because the generated SQL is not correct. Hibernate appends the old database name to the sql like this: myProject.dbo.<table name>, and it is supposed to be myProjectTest.dbl.<table name>

Consequently, all of my unit test fails.

I cleaned the project many times. I manually deleted the class files. I inspected the print out in the console, and hibernate reads from the correct file. I closed Eclipse to clean the cach. But, the problem is still there.

Anyone has ever seen anything like this?
Any idea where else should I look for?

Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic