Hibernate version:
Quote:
2.1.6
Mapping documents: ProductVO.hbm.xml
Quote:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping.dtd">
<hibernate-mapping>
<class name="com.moi.data.ProductVO" table="products">
<id name="id" column="id" type="long">
<generator class="increment"/>
</id>
<property name="name" column="name" type="string"/>
<property name="description" column="description" type="string"/>
<set name="PHasC" role="products_has_components" table="products_has_components">
<key>
<column name="id" not-null="true"/>
</key>
<many-to-many class="com.moi.data.ComponentVO">
<column name="components_id" not-null="true" />
</many-to-many>
</set>
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():Quote:
public Collection getByName(String productName){
Collection products = new ArrayList();
try{
Session session=createSession(ProductVO.class);
//Query q =session.find("SELECT FROM ");
Query q=session.createQuery("from User user WHERE user.id= :name");
q.setString( "name", productName );
products=q.list();
//users=session.find("from Users in class User WHERE User.id="+productName);
}
Full stack trace of any exception that occurs:Quote:
15:20:27,983 INFO Environment:469 - Hibernate 2.1.6
15:20:28,025 INFO Environment:503 - loaded properties from resource hibernate.properties: {hibernate.connection.driver_class=org.gjt.mm.mysql.Driver, hibernate.cglib.use_reflection_optimizer=true, hibernate.cache.provider_class=net.sf.hibernate.cache.EhCacheProvider, hibernate.cache.use_query_cache=true, hibernate.max_fetch_depth=1, hibernate.dialect=net.sf.hibernate.dialect.MySQLDialect, hibernate.jdbc.use_streams_for_binary=true, hibernate.jdbc.batch_size=0, hibernate.query.substitutions=true 1, false 0, yes 'Y', no 'N', hibernate.proxool.pool_alias=pool1, hibernate.connection.username=bugs, hibernate.cache.region_prefix=hibernate.test, hibernate.connection.url=jdbc:mysql://localhost/bugs2, hibernate.show_sql=true, hibernate.connection.password=bugs, hibernate.jdbc.batch_versioned_data=true, hibernate.connection.pool_size=1}
15:20:28,036 INFO Environment:528 - using java.io streams to persist binary types
15:20:28,038 INFO Environment:529 - using CGLIB reflection optimizer
15:20:28,081 INFO Configuration:350 - Mapping resource: com/moi/data/ProductVO.hbm.xml
15:20:30,415 ERROR XMLHelper:48 - Error parsing XML: XML InputStream(15) Attribute "name" must be declared for element type "set".
Name and version of the database you are using:Quote:
mysql 3.23
Debug level Hibernate log excerpt:Quote:
I don't understand why it asks me to declare attribute name for element type set, cause i did it, is someone see a syntax error? I'm quite noob so it can be a really stupid thing.
Thinks for your help.[/quote]