| Hi to everyone, I am new in hibernate and I cant speak english very well, so sorry for any english mistake.
I would really apreciatte if someone could help me!!
 I have two classes, one is USER which has name, password, and a list of perfil(which is profile in english i think). and the other one is Perfil(profile) which has the perfil_id, perfil_description attributes.
 
 What I want is, to persist the class USER to a USER table, using the one-to-many, to persist its PERFILS.
 
 and I DO NOT want to persist the class PERFIL, because it has not a reference to USER, in other words, its not bidirecional.
 
 So i want to persist another table tha contains only the PERFIL_ID from class PERFIL, and USER_NAME, from the class USER. this table doesnt camo from a specifc class. istead of that, it uses attributes from 2 diferent classes.
 
 I made two mapping files that are creating the tables well. the way I want, the problem is only with the primary key. It has to be composited of two fields.
 
 
 /* Table: PERFIL_USUARIO, Owner: SYSDBA */
 
 CREATE TABLE "PERFIL_USUARIO"
 (
 "ID"	INTEGER NOT NULL,
 "NOME_USUARIO_FK"	VARCHAR(255),
 PRIMARY KEY ("ID")
 );
 
 I would like that "NOME_USUARIO-FK" was part of the primary key too, and not only "ID"
 
 
 my mapping files are :
 
 
 USUARIOPERFIL.HBM.XML :
 
 <?xml version="1.0"?>
 <!DOCTYPE hibernate-mapping PUBLIC
 "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
 "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
 
 <hibernate-mapping>
 
 <class name="com.ipq.usuario.UsuarioPerfil"
 table="USUARIO"
 proxy="com.ipq.usuario.UsuarioPerfil">
 <id name="nome" column="NOME" length="8" >
 <generator class="assigned"/>
 </id>
 
 <property name="senha" column="SENHA"
 not-null="true"/>
 
 <bag name="listaPerfil" inverse="true" lazy="true"
 order-by="NOME_USUARIO" cascade="all">
 <key column="NOME_USUARIO_FK"/>
 <one-to-many class="com.ipq.usuario.Perfil"/>
 </bag>
 </class>
 </hibernate-mapping>
 
 
 and
 
 PERFIL.HBM.XML
 
 <?xml version="1.0"?>
 <!DOCTYPE hibernate-mapping PUBLIC
 "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
 "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
 
 <hibernate-mapping>
 
 <class name="com.ipq.usuario.Perfil"
 table="PERFIL_USUARIO"
 dynamic-update="true">
 
 <id name="id" column="ID">
 <generator class="assigned"/>
 </id>
 
 </class>
 </hibernate-mapping>
 
 
 |