views:

158

answers:

1

Hi stackoverflow coders,

I have an app (since the iPhone its really chic to use this word :-)) persisting its data with Hibernate. The database scheme contains several date fields which can be NULL. I configured Hibernate then to fetch the field value also as NULL.

The customer wants to configure these values in case these are NULL. So I decided to have a Properties file containing the default values so nobody has to alter Annotations or database schemes...

My problem now is that I don't know how to realize that in a cool way. The main object I am working with is called Job and contains some joined tables. I don't want to assign the properties file to the Job object, because it wouldn't be persistent anymore. How can I tell Hibernate during creation - hey, you also need a Properties file in case you find NULL columns?

Currently, the only solution I see is to walk over the complete fetched List and analyze the contents of each Job and set them properly if some fields are NULL.

Apparently, I wondered if there is better way to do that...

Thanks for your help and regards from rainy Bonn, Germany,

Marco

+1  A: 

Hibernate have and Events subsystem, you can play with it. There are examples of code doing stuff like you want.

splix
Thanks for the tip. I now use an Interceptor to handle that issue.
Marco Nätlitz