• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to make the column unique?  RSS feed

 
Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi guys

i have a primary key in my table, but for my code column i want it to be unique. how can i do this?

thank you
 
jim li
Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i solve the problem!!

but do you guys know how to delete the whole table from data base by hibernate
session?

thank you
 
author and cow tipper
Saloon Keeper
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


If you pass the SchemaExport class a config object that has nothing in it, and run the create method on the SchemaExport class, it will drop all the tables in the database.




-Cameron McKenzie
 
jim li
Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi

i just clean the the data information from the table, but it does not drop the tables?

the below is my xml file:
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC "221.221.221.73-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="connection.url">
*
</property>
<property name="hibernate.show_sql">
*
</property>
<property name="connection.driver_class">
*
</property>
<property name="connection.username">
*
</property>
<property name="connection.password">
*
</property>
<!-- Set AutoCommit to true -->
<property name="connection.autocommit">
true
</property>
<!-- SQL Dialect to use. Dialects are database specific -->
<property name="dialect">
org.hibernate.dialect.Oracle10gDialect
</property>
<property name="hibernate.hbm2ddl.auto">
update
</property>
<!-- Mapping files -->
<mapping class="com.blinco.wave3x.account.Division"/>
<mapping class="com.blinco.wave3x.account.Department"/>
<mapping class="com.blinco.wave3x.account.UserGroup"/>
<mapping class="com.blinco.wave3x.account.UserInfo"/>
<mapping class="com.blinco.wave3x.account.Company"/>
<mapping class="com.blinco.wave3x.account.CompanyType"/>
<mapping class="com.blinco.wave3x.account.Country"/>
<mapping class="com.blinco.wave3x.account.State"/>
<mapping class="com.blinco.wave3x.app.App"/>
<mapping class="com.blinco.wave3x.app.Module"/>
<mapping class="com.blinco.wave3x.app.Bookmark"/>
<mapping class="com.blinco.wave3x.app.UserRating"/>
<mapping class="com.blinco.wave3x.app.Permission"/>
</session-factory>
</hibernate-configuration>
 
jim li
Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi

i got the problem

in stead of using new SchemaExport(config).create(true, true);

i used new SchemaExport(config).drop(true, true);
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!