0

I develop company app(JSF maven project) and we use HIbernate. I have no previus experiences with Hibernate. Application is created in that way that there is some auto-build and auto-deploy in time of starting tomcat from eclipse. I need to make first time http login call to application (which always throws exception because there are no data in DB) to hibernate create database schema automaticly on server. And then to manualy insert all data in MS Sql server query. Is it some way (or eclipse plugin) to generate sql create database (all tables) script from entity source codes + persistence.xml or how to do it automate in time of deploying application?

1 Answer 1

1

This setting in your hibernate config, creates the schema automatically everytime based on your hibernate entities. Other options are update, create-drop and validate.

<hibernate-configuration>
    <session-factory>
        <property name="hbm2ddl.auto">create</property>
Sign up to request clarification or add additional context in comments.

3 Comments

this put to persistence.xml ?
@falconseye yes, but using in live environemnt is somewhat frowned upon, by DBA's at least. They think they know best.
is it proper tag for persistence.xml? I have found something else <property name="hibernate.hbm2ddl.auto" value="create" /> ...but it does not work :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.