Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Listing dodgy data
PostPosted: Thu May 19, 2005 4:37 am 
Beginner
Beginner

Joined: Tue May 10, 2005 6:25 am
Posts: 20
Location: London
I'm running Hibernate over a legacy database. I'm pretty sure that I've got the mappings more or less right now - I can read valid data without problems.

The problem is that the data in the database has some problems. There are occasional problems with relational integrity, and problems with data values. As soon as Hibernate hits one of these problems, it throws a HibernateException, and stops running the query.

I have no problem with the exception being thrown. In fact, that's exactly what I want to happen. And in production, it's fine for the query to stop. The thing is, though, that I'd like a way to list all the data errors, so that I can do a data-cleansing exercise up front. Is there a way to process the results of a query a row at a time, so that I can identify all the problems in one go?

_________________
Cheers,
Simon B,
simon@brunningonline.net,
http://www.brunningonline.net/simon/blog/


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 24, 2005 5:02 am 
Beginner
Beginner

Joined: Tue May 10, 2005 6:25 am
Posts: 20
Location: London
I can think of two workarounds. I could make the reporting currency code available as a property rather than relating back to the current table directly. Retrieving the currency object would then be the client code's job. Or, perhaps I could try building the company to currency link as a one to many. I'm not even sure that that would work. Besides, I really want to fix this problem properly, for one and for all. I'll probably come across a lot of this kind of relationship as I map more of my legacy database.

_________________
Cheers,
Simon B,
simon@brunningonline.net,
http://www.brunningonline.net/simon/blog/


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 24, 2005 5:07 am 
Beginner
Beginner

Joined: Tue May 10, 2005 6:25 am
Posts: 20
Location: London
simon.brunning wrote:
I can think of two workarounds...


This reply was meant for another thread. :-(

_________________
Cheers,
Simon B,
simon@brunningonline.net,
http://www.brunningonline.net/simon/blog/


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 25, 2005 3:50 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8611
Location: Neuchatel, Switzerland (Danish)
eh ? doesn't sound like something hibernate should do.

You should write some queries that checks this for you - its a typical data maintanence jobs.

p.s. check out not-found attribute which allow you to control wether an exception is thrown or not.

_________________
Max
Don't forget to rate


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.