java - Prevent Hibernate schema changes -
i new hibernate , having issue configuration. trying setup read-only connection preexisting oracle database. not want hibernate execute dml/ddl , alter database schema, yet every time try deploying project, message see:
info: updating schema severe: unsuccessful: create table willoem.sample_info (sample_id varchar2(255) not null, cell_line varchar2(255), study_id varchar2(255), primary key (sample_id)) severe: ora-00955: name used existing object
no damage being done here, since table creation failed, don't want create situation data can lost. how can configure hibernate act in read-only manner? can prevent statement execution completely, without adding new oracle user lacks privileges?
here current hibernate configuration:
<bean id="datasource" class="org.springframework.jdbc.datasource.drivermanagerdatasource"> <property name="driverclassname"><value>oracle.jdbc.oracledriver</value></property> <property name="url"><value>jdbc:oracle:thin:@source.db.somewhere.com:1524:willoem</value></property> <property name="username"><value>username</value></property> <property name="password"><value>password</value></property> </bean> <bean id="sessionfactory" class="org.springframework.orm.hibernate3.annotation.annotationsessionfactorybean"> <property name="datasource"><ref local="datasource"/></property> <property name="packagestoscan" value="com.willoem.project.hibernate" /> <property name="hibernateproperties"> <props> <prop key="hibernate.dialect">org.hibernate.dialect.oracledialect</prop> <prop key="hibernate.show_sql">true</prop> <prop key="hibernate.hbm2ddl.auto">update</prop> </props> </property> </bean> <bean id="transactionmanager" class="org.springframework.orm.hibernate3.hibernatetransactionmanager"> <property name="sessionfactory"><ref local="sessionfactory"/></property> </bean>
you change
<prop key="hibernate.hbm2ddl.auto">update</prop>
to
<prop key="hibernate.hbm2ddl.auto">validate</prop>
this validates schema, not make no changes it.
Comments
Post a Comment