To get a table instance of a database using a mapping file
Establish. java, the corresponding database table in the column to establish the instance domain, the naming can be different, because the mapping file will be mapped work.
Right-click this java file, New->other create the. hbm.xml file
Modify the. hbm.xml file
<class name= "Cn.stargis.estar.basic.sequencemanager.model.SYS_SEQ_DEF" table= "Sys_seq_def" >
Name is the. Java location, Sys_seq_def is the. java file name
database table name after table
<id name= "id" type= "string" >
<column length= "+" name= "ID"/>
<generator class= "uuid"/>
</id>
"id" is the instance name in Java, and "id" is the column name in the database table.
Length is used to limit the lengths of generator "uuid" to denote the random generation of IDs.
For other general columns, the above is the primary key column
<property generated= "Never" lazy= "false" Name= "RuleId" type= "string" >
<column length= "+" name= "rule_id"/>
</property>
Name= "RuleId". The instance name in Java, name= the column name in the RULE_ID database table. This is done. Java binds to the table.
Table mapping file problems, Javaweb+hibernate,. hbm.xml