yes, my db is empty when importing. i am using hibernate 3.1rc3. not sure if that makes a difference. i looked at the source code where the exception was thrown, it's looking for a persistent collection and my object is a dom4j element. maybe the code is broken somehow?
i am loading roles first, followed by session flush, then loading users. 
below is my mapping file:
user:
<?xml version="1.0" encoding="UTF-8"?>
<!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.foo.User"
        table="fos_user"
    >
        <id
            name="userId"
            column="user_id"
            type="java.lang.String"
            length="256"
        >
            <generator class="assigned">
            </generator>
        </id>
        <property
            name="firstName"
            type="java.lang.String"
            update="true"
            insert="true"
            column="first_name"
            length="64"
        />
        <property
            name="lastName"
            type="java.lang.String"
            update="true"
            insert="true"
            column="last_name"
            length="64"
        />
        <property
            name="password"
            type="java.lang.String"
            update="true"
            insert="true"
            column="password"
            length="64"
        />
        <set
            name="roles"
            table="fos_user_roles"
            lazy="false"
            cascade="none"
            sort="unsorted"
        >
            <key
                column="user_id"
            >
            </key>
            <many-to-many
                class="com.foo.Role"
                column="user_role"
                outer-join="auto"
                embed-xml="false"
             />
        </set>
    </class>
</hibernate-mapping>
role:
<?xml version="1.0" encoding="UTF-8"?>
<!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.foo.Role"
        table="fos_role"
        lazy="false"
    >
        <id
            name="name"
            column="name"
            type="java.lang.String"
            length="64"
        >
            <generator class="assigned">
            </generator>
        </id>
        <property
            name="description"
            type="java.lang.String"
            update="true"
            insert="true"
            column="description"
            length="256"
        />
    </class>
</hibernate-mapping>
firebug wrote:
I am using hibernate 3.0.5 and I can import/export sucessfully.  Firstly, I imagine your database is empty when you are importing?
Map the user-role joint table to be as follows;
Code:
<many-to-one name="role" column="role_id" not-null="true"/>
<many-to-one name="user" column="user_id" not-null="true"/>
This will include the parent user & role entities into your user-role joint object xml.
In User and Role object mapping make sure you have turned off the xml using embed-xml="false".
When import, make sure that you import in the sequence of User, Role and User-Role. Also, user the session.replicate() to do the insert or update to the database. Hope this help you.
Quote:
Don't forget to rate if this solution works