I want an application to initialize database automaticly, if there're no proper relations yet. I use SchemaExport class. The problem is i don't know how to check if schema was exported already. I use work-around:
1. The user specifies DB url
2. Application connects to DB (creates session)
1. Application tries to find any object of specified type first
2. If HibernateException occurs, I assume schema wasn't exported yet, and I perform SchemaExport.
It works fine but it's like scrathing oneself in the left ear using right foot.
Anybody has an idea how to check if relation in database exist?
Thnx in advance.
|