은 다음 매우 중요한최대 절전 모드 오류 작은 문제지만
여기<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="com.mmm.data.UserRating" table="userratings" catalog="mmm">
<composite-id name="id" class="mmm.UserRatingId">
<key-property name="userId" type="int">
<column name="userId" />
</key-property>
<key-property name="recipeId" type="int">
<column name="recipeId" />
</key-property>
</composite-id>
<many-to-one name="recipe" class="com.mmm.data.Recipe" update="false" insert="false" fetch="select">
<column name="recipeId" not-null="true" />
</many-to-one>
<many-to-one name="user" class="com.mmm.data.User" update="false" insert="false" fetch="select">
<column name="userId" not-null="true" />
</many-to-one>
<property name="rating" type="int">
<column name="rating" not-null="true" />
</property>
</class>
</hibernate-mapping>
자바 내 .hbm.xml입니다 : 내가 할 때 UR을 UserRating에서 "
public class UserRating implements java.io.Serializable
{
private UserRatingId id;
private Recipe recipe;
private User user;
private int rating;
/**
*
*/
public UserRating()
{
}
/**
*
* @param id
* @param recipes
* @param users
* @param rating
*/
public UserRating( UserRatingId id,
Recipe recipes,
User users,
int rating)
{
this.id = id;
this.recipe = recipes;
this.user = users;
this.rating = rating;
}
public UserRating( UserRatingId id)
{
this.id = id;
}
/**
*
* @return
*/
public UserRatingId getId()
{
return this.id;
}
/**
*
* @param id
*/
public void setId(UserRatingId id)
{
this.id = id;
}
/**
*
* @return
*/
public Recipe getRecipe()
{
return this.recipe;
}
/**
*
* @param recipe
*/
public void setRecipe(Recipe recipe)
{
this.recipe = recipe;
}
/**
*
* @return
*/
public User getUser()
{
return this.user;
}
/**
*
* @param user
*/
public void setUser(User user)
{
this.user = user;
}
/**
*
* @return
*/
public int getRating()
{
return this.rating;
}
/**
*
* @param rating
*/
public void setRating(int rating)
{
this.rating = rating;
}
}
public class UserRatingId implements java.io.Serializable
{
private int userId;
private int recipeId;
/**
*
*/
public UserRatingId()
{
}
/**
*
* @param userId
* @param recipeId
*/
public UserRatingId( int userId,
int recipeId)
{
this.userId = userId;
this.recipeId = recipeId;
}
/**
*
* @return
*/
public int getUserId()
{
return this.userId;
}
/**
*
* @param userId
*/
public void setUserId(int userId)
{
this.userId = userId;
}
/**
*
* @return
*/
public int getRecipeId()
{
return this.recipeId;
}
/**
*
* @param recipeId
*/
public void setRecipeId(int recipeId)
{
this.recipeId = recipeId;
}
/**
*
*/
public boolean equals(Object other)
{
if ((this == other))
return true;
if ((other == null))
return false;
if (!(other instanceof UserRatingId))
return false;
UserRatingId castOther = (UserRatingId) other;
return (this.getUserId() == castOther.getUserId())
&& (this.getRecipeId() == castOther.getRecipeId());
}
/**
*
*/
public int hashCode()
{
int result = 17;
result = 37 * result + this.getUserId();
result = 37 * result + this.getRecipeId();
return result;
}
}
곳 ur.recipeId = recipeId 및 rr.userId = : userId "; get : Initial SessionFactory creation failed.org.hibernate.HibernateException : 기본 tuplizer를 인스턴스화 할 수 없습니다. [org.hibernate.tuple.component.PojoComponentTuplizer]
이유가 무엇입니까? 없어진 물건 있어요?
당신이 – Saket
가 부착 된 다른 클래스 정의를 게시 할 수 있습니다 .............. – Yoav