Skip to content

Instantly share code, notes, and snippets.

@alterscape
Created November 12, 2012 21:05
Show Gist options
  • Save alterscape/4061890 to your computer and use it in GitHub Desktop.
Save alterscape/4061890 to your computer and use it in GitHub Desktop.
Some Hibernate mapping
<?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="name.ryanspicer.oncewhen.corpus.Face" table="faces">
<!-- snip -->
<set fetch="select" inverse="false" lazy="true" name="peopleAssignments" table="people_faces" cascade="all">
<key>
<column name="person_id" not-null="true"/>
</key>
<one-to-many class="name.ryanspicer.oncewhen.corpus.PersonFace"/>
</set>
</class>
<class name="name.ryanspicer.oncewhen.corpus.Person" table="people">
<id column="id" name="id" type="long">
<generator class="native"/>
</id>
<property name="name"/>
<set fetch="select" inverse="false" lazy="true" name="Faces" table="people_faces_imputed" cascade="all">
<key>
<column name="person_id"/>
</key>
<one-to-many class="name.ryanspicer.oncewhen.corpus.PersonFace"/>
</set>
</class>
<class name="name.ryanspicer.oncewhen.corpus.PersonFace" table="people_faces">
<id column="id" name="id" type="long">
<generator class="native"/>
</id>
<many-to-one class="name.ryanspicer.oncewhen.corpus.Face" fetch="select" name="face">
<column name="face_id" not-null="true"/>
</many-to-one>
<many-to-one class="name.ryanspicer.oncewhen.corpus.Person" fetch="select" name="person">
<column name="person_id" not-null="true"/>
</many-to-one>
<property name="confidence" not-null="true"/>
</class>
</hibernate-mapping>
@alterscape
Copy link
Author

            PersonFace pf = new PersonFace();
            pf.setPerson(p);
            pf.setFace(f);
            pf.setConfidence(0.5f);
            pFaces.add(pf);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment