• 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 ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Hibernate keeps updating database.

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

I met a weird problem when using hibernate 3.0. I got a table that has 63 columns. But when I try to load all data twice using hibernate, it will keep updating the table. And sometimes when I delete some columns in the configuration, it will work fine, but sometimes it still doesn't work. It's uncertain.

And another weird problem maybe related to this. I try to insert the data into this table using hibernate, but somehow, some columns will always show 0 value as I put whatever numeric values to them.

Thanks!
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you show us your code?
 
Mingwei Jiang
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


And hql will be something like:


And this table has 63 columns, has column types like Number(18), Numeric(12, 6), Varchar2, Char and Date. Nomally it will have around 5000 records. Weird thing is it will keep updating the table after I call findList twice. Thanks.
 
Paul Sturrock
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hmm. There's nothing in that code that will update anything. Enable Hibernate degugging (hibernate.show_sql=true) and see what SQL Hibernate generates.
 
Mingwei Jiang
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I got the reason for this. It is because the FLUSHMODE thing. If I set the flush mode to never, it works fine for querying and loading data. But another problem comes up, this table is not read only, I need to update and insert also. If I set it to never flush mode, I have to manully call flush to update and insert data, but this again cause the hibernate to keep updating that table.

The annoying thing is other tables are working pretty fine. Only this table keeps updating when I try to load data, update or insert.

And like I said before, there're 10 columns in this table that whatever values you give to them, they will become 0. And I tried to change the column names or hibernate mapping name for these columns, then it works fine, I think somehow these 2 problems are related.

But to be honest, change names is not a good reason for solving problems I think. So I have to find the radical.
reply
    Bookmark Topic Watch Topic
  • New Topic