0

I am using Hibernate for connecting to derby . i am using derby as an in-memory database for my application. I am completely new to hibernate and derby stuff. I have two xml files, sample.cfg.xml and sample.hbm.xml. The sample.hbm.xml contains the mapping between the table and the bean class. I am setting the in-memory db as follows:

       Dialect = org.hibernate.dialect.DerbyDialect
       DriverClassName = org.apache.derby.jdbc.EmbeddedDriver
       Url= jdbc:derby:unitTestDB;create=true
       UserName = ""
       Password=""

My question is , will the table be automatically created ? (by using the sample.hbm.xml as a reference) or do i need to create the table separately ? Pardon my ignorance as i am completely new to this.

1 Answer 1

2

By default tables are not automatically created. Tables will be created if you advice Hibernate to do so by giving needed value for hibernate.hbm2ddl.auto attribute in configuration (properties in same place where you have other properties that you listed in query).

Most likely for development create-drop is best options in general, every time you deploy you will start with fresh database. For in-memory it is of course always fresh. Other options are: validate, update and create.

Sign up to request clarification or add additional context in comments.

Comments

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.