[Hibernate] MappingException

This is a discussion on [Hibernate] MappingException within the JDBC JAVA forums in Framework and Interface Programming category; 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" ...

Go Back   Application Development Forum > Framework and Interface Programming > JDBC JAVA

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 01-08-2006, 06:38 PM
marc
Guest
 
Default [Hibernate] MappingException

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

Reply With Quote
  #2  
Old 01-09-2006, 09:44 AM
jlp
Guest
 
Default Re: [Hibernate] MappingException

Property awayTeamScore must be a Class and serializable, int is not.
"marc" <msiramy@free.fr> a écrit dans le message de
news:1136763482.871812.192140@g49g2000cwa.googlegr oups.com...
> 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
>



Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 06:27 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.