hbm

Transform .HBM model to annotated pojos

We have our domain model declared in rusty old hbm files, we wish to move to POJOs annotated with the javax.persistence.* annotations. Has anyone had experience doing so? Are there tools that we could employ? ...

Doubly connected ordered tree mapping using NHibernate

Hello, everyone! We need to map simple class using NHibernate: public class CatalogItem { private IList<CatalogItem> children = new List<CatalogItem>(); public Guid Id { get; set; } public string Name { get; set; } public CatalogItem Parent { get; set; } public IList<CatalogItem> Children { get { return...

How do I output the HBMs that Fluent NHibernate Creates?

I am debugging my fluent application and would like to see what the generated files look like. Can someone help me out? -Nick ...

set lazy as true during HQL execution time

In our application, we have various objects set to lazy false based on the application needs. However, in one of the use case we want to ignore all the lazy settings within the HBM files, and get ONLY the target object. So the question is: is there a way to specify in the HQL to fetch ONLY the target object irrespective of the HBM sett...

How to see the the HBM from mappings was built in runtime?

I have a predefined Configuration instance where I'm fetching ClassMappings and adding some extra properties depends on MappedClass nature. And I have a problem with a propery maps wrong. Is there any way to build the HBM presentation from the presented configuraion to be able to see the errors by eyes? ...

Generating Hibernate hbm xml files & entities classes from existing DB schema

Dear colleagues, How can I generate Hibernate hbm xml files & entities classes from existing DB schema? Sharon ...

Fluent NHibernate and Stored Procedures

I have a basic Customer/Order/OrderItem/Product object graph. Customer has Many Orders, Order has Many Order Items, Product has many Order Items. These are successfully mapped using FNH. I've hit a snag with configuring a stored procedure & fluent-nhibernate. There is not a native way to map stored procedures in fluent-hibernate FNH ...

Can anyone recommend a NHibernate generating tool?

I want to auto generate .hbm mapping files from my domain objects ...

Adding an enum as a class property in HBM.

I am trying to create a class in HBM file which contains an Enum as a field. The HBM is similar to this: <class name="a.b.c.myObject" table="OBJECT" > <property name="myEnum" column="EXAMPLE" type="a.b.c.myEnum" /> </class> and let's say that this is the Enum: public enum myEnum{ a, b, c; } The problem is that in the DB...

Not so simple Hibernate question

Hey people, i have a the following map* which is giving me lots of trouble: Map<MetricSourceInterface, AliasesInterface> MetricSourceInterface is an entity with simple properties. AliasesInterface is an entity with only an Id and a list of strings. Hibernate is creating the database schema so theres no problem with changing it whatso...

How do I map List<List<EntityClass>> in NHibernate?

I have a Rotation class, which contains references to multiple lists of Advert objects. I would prefer an implementation where Rotation has a property of type List<List<Advert>> to hold these, but I am unable to come up with an NHibernate mapping supporting this. In the database schema, the many-to-many relation between Rotation and Adv...

How to specify a mixed table-per-subclass -> table-per-hierarchy in NHibernate HBM?

I'm mixing table mapping strategies to store a class hierarchy via NHibernate 2.1.2. I'm not using Fluent NHibernate. I understand how to map a table-per-hierarchy -> table-per-subclass structure, but not the other way around, as the XML is invalid after adding the discriminator. Here's the HBM extract: <class name="Base1" table="Ba...

How to use Dynamic Instantiation with ICriteria in Nhibernate?

I know that you can do this easily with HQL using the following syntax: "select new ItemRow(item.id, item.name) from ..." In this example, the ItemRow need not be a persistent class that has its own mapping class. But how can we accomplish the same using ICriteria? ...

Is it possible to configure NHibernate at runtime setting the loading-technique (eager/lazy) for a collection

Ya is this possible :) ? ...

Setting the default orderby for an entity in the mapping file?

Is it possible to set the default order-by column to use in the NHibernate mapping file? Unless explicitly defined I want to order all specific entities by the Name column automatically. I've seen that it can be done on collections but thats not what I'm after in this case. ...

Hibernate HBM documentation

I am looking for documentation for Hibernate HBM tag (e.g. allowed attributes for each tag) ...

avoid duplication with auto increment key in Hibernate

I am trying to use Hibernate to auto increment the id, however, I try to avoid duplication. class Service { Long id; // auto increment String name; String owner; Boolean incremental; // setter and getter } What I want to achieve is, whenever the new service object I want to save has the same name and owner(no matter...

NHibernate stored procedure problem

I'm having a hard time trying to get my stored procedure works with NHibernate. The data returned from the SP does not correspond to any database table. This is my mapping file: <?xml version="1.0" encoding="utf-8" ?> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="DomainModel" namespace="DomainModel.Entities"> <sq...

Delete element from Set

Hi. I have 2 classes Tema(Homework) and Disciplina (course), where a Course has a Set of homeworks. In Hibernate i have mapped this to a one-to-many associations like this: <class name="model.Disciplina" table="devgar_scoala.discipline" > <id name="id" > <generator class="increment"/> </id> <set name="listaTeme" table="devgar_sc...

Set creation and update time with Hibernate in Xml mappings

Hi, I'm using Hibernate with Xml mappings. I have an entity that has two fields creationDate and updateDate of type timestamp, that have to be filled with the current UTC time when the entity is persisted and updated. I know about the existence of the @PrePersist and @PreUpdate annotations, but i don't know how to use their equivalent in...