Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:3.1
Eclipse version: 3.1
here the error :
<Sessionfactory error: entity class not found: chapter2.Artist >
Here is their mapping :
Track.hbm.xml:
<?xml version="1.0" ?>
<!DOCTYPE hibernate-mapping SYSTEM "E:/OpenSourceLib/hibernate-3.1/src/org/hibernate/hibernate-mapping-3.0.dtd" >
<hibernate-mapping>
<class name="chapter2.Track" table="TRACK">
<meta attribute="class-description">
Represents a single playable track in the music database
</meta>
<id name="id" type="integer" column="Track_ID">
<meta attribute="scope-set">protected</meta>
<generator class="native"></generator>
</id>
<property name="title" type="string">
<meta attribute="use-in-tostring">true</meta>
<column name="TITLE" not-null="true" index="TRACK_TITLE"/>
</property>
<property name="filePath" type="string" not-null="true" />
<property name="playTime" type="time">
<meta attribute="field-description">Playing Time
</meta>
</property>
<set name="artists" table="TRACK_ARTISTS">
<key column="TRACK_ID"/>
<many-to-many class="chapter2.Artist" column="ARTIST_ID"/>
</set>
<property name="added" type="date">
<meta attribute="field-description">When track is created.
</meta>
</property>
<property name="volume" type="short">
<meta attribute="field-description">How loud to play this
</meta>
</property>
</class>
<query name="chapter2.tracksNoLongerThan">
<![CDATA[from chapter2.Track as track
where track.playTime <= :length
]]>
</query>
</hibernate-mapping>
**********************************************
Artist.hbm.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping SYSTEM "E:/OpenSourceLib/hibernate-3.1/src/org/hibernate/hibernate-mapping-3.0.dtd" >
<hibernate-mapping>
<class name="chapter2.Artist" table="ARTIST">
<meta attribute="class-description">
Represents an artist who is associated with a track or album
@author Nguyen Thanh Nha
</meta>
<id name="id" type="integer" column="ARTIST_ID">
<meta attribute="scope-set">protected</meta>
<generator class="native" />
</id>
<property name="name" type="string">
<meta attribute="use-in-tostring">true</meta>
<column name="NAME" not-null="true" unique="true"
index="ARTIST_NAME" />
</property>
<set name="tracks" table="TRACK_ARTISTS" inverse="true">
<meta attribute="field-description">
Tracks by this artist
</meta>
<key column="ARTIST_ID" />
<many-to-many class="chapter2.Track" column="TRACK_ID" />
</set>
</class>
</hibernate-mapping>
when i use code generation, use .java and shema exporter , i found the above error . i run " run schema exporter" on hibernate console , i see every thing is ok , it create track , artist , and track_artist table .
but i don't understand what this error means .
another problem is in source directory , i see track.java ,artist.java, TrackHome.java ,ArtistHome.java .
what is *Home file use for ?
and if i run code generate from command promt ,using ant tool, no home file is create .
can you explain it for me .
Thank in advance .