导入关键jar
举炉石传说卡片说明,Card.java Card.hbm.xml
Card.java
Card.hbm.xml
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated 2018-10-12 15:08:50 by Hibernate Tools 3.5.0.Final -->
<hibernate-mapping>
<class name="info.Card" table="CARD">
<id name="id" type="java.lang.Integer">
<column name="ID" />
<generator class="assigned" />
</id>
<property name="cardType">
<column name="CARDTYPE" />
<type name="org.hibernate.type.EnumType">
<param name="type">12</param>
<param name="enumClass">infoEnum.CardType</param>
</type>
</property>
<property name="position">
<column name="POSITION" />
<type name="org.hibernate.type.EnumType">
<param name="type">12</param>
<param name="enumClass">infoEnum.Position</param>
</type>
</property>
<property name="cost" type="int">
<column name="COST" />
</property>
<property name="content" type="java.lang.String">
<column name="CONTENT" />
</property>
<property name="description" type="java.lang.String">
<column name="DESCRIPTION" />
</property>
<property name="cardName" type="java.lang.String">
<column name="CARDNAME" />
</property>
<property name="imgURL" type="java.lang.String">
<column name="IMGURL" />
</property>
</class>
</hibernate-mapping>
hibernate的配置,hibernate.cfg.xml
运行Demo
结果