Search code examples
nhibernatefluent-nhibernatenhibernate-mapping

NHibernate Java style mapping


When you map an entity with Java Hibernate it's easy and all you have to do is annotate the class itself. For example:

@Entity
@Table(name="students")
public class Student implements Serializable {
    private static final long serialVersionUID = 1L;

    @Id
    private Integer uniqid;

    @Column(name="first_name")
    private String firstName;

    @OneToMany
    @JoinColumn(name = "id")
    private List<Address> addressesList;
}

I am trying to use NHibernate on a .NET WCF project.

Can I use meta-tags to map entities like I do in Java normal hibernate?


Solution

  • This feature is available in the NHibernate.Mapping.Attributes namespace. You can download the most recent version here for NH 3.2.0GA.