Howdy all!
I've got a real simple table, a primary key (player_id) and 2 columns (property_code. value). There are several entries with the same primary key. I try to retrieve all entries by a 'from player_property p where p.player_id=<some number>'. The result set is the right size but the data in the set are copies of the first found entry. I've tried to figure this one out to no avail. I'm sure this is easy, please somebody help me out here.
cheers
Erik
Hibernate version:
2.1
Mapping documents:
Using xdoclet
Code between sessionFactory.openSession() and session.close():
/*
* @hibernate.class table="@
[email protected]_property"
*
*/
public class PropertyDO {
private Integer playerId;
private String propertyCode;
private String value;
/**
*
* @hibernate.id column="player_id" generator-class="assigned"
* @return Returns the playerId.
*/
public Integer getPlayerId() {
return playerId;
}
/**
* @param playerId The playerId to set.
*/
public void setPlayerId(Integer playerId) {
System.out.println("PropertyDO.setPlayerId:"+playerId);
this.playerId = playerId;
}
/**
*
*
* The actual data. Could be crypted.
*
* @hibernate.property column = "property_code"
*
* @return Returns the propertyCode.
*/
public String getPropertyCode() {
return propertyCode;
}
/**
* @param propertyCode The propertyCode to set.
*/
public void setPropertyCode(String propertyCode) {
this.propertyCode = propertyCode;
}
/**
* @hibernate.property column = "value"
* @return Returns the value.
*/
public String getValue() {
return value;
}
/**
* @param value The value to set.
*/
public void setValue(String value) {
this.value = value;
}
}
Name and version of the database you are using:
MySQL 4.0
The generated SQL (show_sql=true):
from com.ongame.naps.service.core.playeradmin.impl.PlayerPropertyDO pp where pp.playerId = 1
Hibernate: select propertydo0_.player_id as player_id, propertydo0_.property_code as property2_, propertydo0_.value as value from network_player_beta.player_property propertydo0_ where (propertydo0_.player_id=? )