English 中文(简体)
hibernate.hbm2dl.auto Value to do both the operations ie establish/update on database schema?
原标题:hibernate.hbm2ddl.auto value to do both the operations i.e create/update on database schema?

i want to know for now, Is it possible in hibernate to create database schema if schema does not exist otherwise update the schema if it is already exist and there are some modification in hbm file with some value for property hibernate.hbm2ddl.auto .

As per my understanding create value will always drop the previous schema and create the new schema ? update value will not create new schema, it will just update the schem if exist a based on hbm.xml. Right?

www.un.org/Depts/DGACM/index_spanish.htm 地雷计划是当地chem,而不是生产chem。

最佳回答

www.un.org/Depts/DGACM/index_french.htm 如果不存在新计划,将确实产生新的计划。

问题回答

你不需要使用SchemaExport,你只能使用SchemaUpdate。 它发挥了巨大作用,如果你愿意,你可以先审查 s。

你们确实需要建立数据库,或为此使用一些支架。 之后:

import org.hibernate.cfg.Configuration;
import org.hibernate.tool.hbm2ddl.SchemaUpdate;

public static void updateDb(Configuration cfg, boolean printSqlToConsole, boolean commit)
{
    SchemaUpdate u = new SchemaUpdate(cfg);
    u.setFormat(printSqlToConsole);
    u.execute(printSqlToConsole, commit);
}

Note: that it can do notprocess knownd/changed areas, You need to take care of that. 但它可以处理新的领域。 未绘制地图的领域被忽视。





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签