Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Databases / January 2006

Tip: Looking for answers? Try searching our database.

[Hibernate] MappingException

Thread view: 
marc - 08 Jan 2006 23:38 GMT
Hello,

I encounters a problem while using 'ShemaExport' Hibernate
functionnality:

[schemaexport] GRAVE: Could not compile the mapping document
[schemaexport] org.hibernate.MappingException: class
foot.hibernate.Game not found while looking for property: awayTeamScore

Please see below my configuration files:
hibernate.cfg.xml :

<session-factory>
[...]
<property name="show_sql">true</property>
   <property name="hbm2ddl.auto">create</property>
   <mapping resource="foot/hibernate/Coach.hbm.xml" />
   <mapping resource="foot/hibernate/Player.hbm.xml" />
   <mapping resource="foot/hibernate/Team.hbm.xml" />
   <mapping resource="foot/hibernate/Game.hbm.xml" />
</session-factory>

Game.hbm.xml :
 <hibernate-mapping package="foot.hibernate">
    <class name="Game" table="GAME" lazy="true">
        <id name="gameId" column="GAME_ID" type="java.lang.Long">
            <generator class="native"/>
        </id>
        <property name="awayTeamScore" column="AWAY_TEAM_SCORE" />
        <property name="homeTeamScore" column="HOME_TEAM_SCORE" />
        <property name="gameDate" column="GAME_DATE" />
        <many-to-one cascade="none" name="mostValuablePlayer"
           class="Player" column="PLAYER_ID" />
        <many-to-one cascade="none" name="homeTeam"
           class="Team" column="HOME_TEAM_ID" />
        <many-to-one cascade="none" name="awayTeam"
           class="Team" column="AWAY_TEAM_ID" />
    </class>
</hibernate-mapping>

Game.java :
 private int awayTeamScore;

public int getAwayTeamScore() {
      return awayTeamScore;
}
public void setAwayTeamScore(int awayTeamScore) {
   this.awayTeamScore = awayTeamScore;
}

I don't understand that the class Game is the only Class which creates
problem
Could someone help me ?

--
Marc
jlp - 09 Jan 2006 14:44 GMT
Property awayTeamScore must be a Class and serializable, int is not.
> Hello,
>
[quoted text clipped - 52 lines]
>  --
>  Marc


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.