Reputation: 2069
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.
Upvotes: 0
Views: 694
Reputation: 42094
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.
Upvotes: 2