Win a copy of Practice Tests for OCP Java 17 Certification Exam (1Z0-829) this week in the OCPJP forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Scott Selikoff
Bartenders:
  • Piet Souris
  • Jj Roberts
  • fred rosenberger

how to make the column unique?

 
Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 5006
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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);
 
reply
    Bookmark Topic Watch Topic
  • New Topic