Hi,
i've being banging my head against the desk all day with the following Nhibernate problem.
Each bank account has one (and only one) set of rates associated with it. The primary key of the bank account table, BankAccountID is also a foreign key and the primary key in the AccountRate table.
public class BankAccount
{
public virtu...
I use Hibernate3 and Hibernate Tools 3.2.4 to generate hbm.xml and java files and I want to use List instead of HashSet(...). I've tried to modify the hbm.xml files, putting list instead of set. Is there any way to specify to hibernate tools that I want to generate automatically a list not a HashSet?
This is an exemple:
Java class
publ...
I have two different data models that map to the same Car entity. I needed to create a second entity called ParkedCar, which is identical to Car (and therefore inherits from it) in order to stop nhibernate complaining that two mappings exists for the same entity.
public class Car
{
protected Car()
{
IsParked = false;
...
I have the following mapping files:
<?xml version="1.0" encoding="utf-8"?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
assembly="MyAssembly" namespace="EntityNamespace">
<class name="Server" xmlns="urn:nhibernate-mapping-2.2" table="tblServer" >
<id name="Id" type="int">
<generator class="native"...
I'm trying to do Table per subclass: using a discriminator using NHibernate.Mapping.Attributes.
The hbm should look like this:
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<subclass name="SalesReport" discriminator-value="SalesReport" extends="Report">
<join table="SalesReport">
<key foreign-key="FK_SalesReport_Doc...
How would I generate the hbm file for the following scenario? In particular, I'm having trouble modeling the many-to-many relationship's composite key.....
Table: Course
Primary Key: CourseId
Table: Enrollment
Primary Key: CourseId, StudentId
Table: Fees
Primary Key: FeeId
Other Columns: Amount, Description
Table: Enrollment_Has_Fees...
I have the following classes:
public class A {
public virtual int Id { get; private set; }
public virtual IDictionary<MyEnum, B> MyBValues { get; set; }
}
public class B {
public virtual int Id { get; private set; }
}
public enum MyEnum { Value1, Value2, Value3 }
And would like the following tables:
A
------------...
I have the following HBMs (the sample is purely fictional, so don't try to understand the business needs)
Class Document
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="Document" discriminator-value="Document">
<id name="Id" type="long">
<generator class="native" />
</id>
<discriminator />
<p...
(Parenthetical rant:) I'm a Hibernate beginner getting slightly frustrated by the overhead of a simple join that I could write in 15 seconds in SQL. (End rant)
The situation is thus: I have 2 tables that both contain the same composite primary key - let's call the columns in both tables 'ID' and 'Version'. I need data about a particula...
This question was asked before but the answers all show how to export the hbm files from fluentnhibernate. We are using S#arpArchitecture which wraps fluent. I am able to export the schema but what I really want is the xml files to troubleshoot errors. I've done this using FNH before but adding S#arp to the mix has complicated things wh...
I'm facing problems with composite keys in S#arp architecture. Anyone have an example of how to do that or how to use mapping files with automapping?
...
Are there any tools or clever methods for me to I visualize the contents of NHibernation hbm.xml files?
I would like to load hbm files into a designer and see them as entities with relations
...
I have a one-to-many relationship and in my HBM I want to include the association for delete purposes. How can I express that without query/loading the related table/object?
Just including a bag or another collection is the obvious answer, but is there something else?
Hibernate 2.2
...
Background
We have several projects / applications running off the same model. They all have their own unique entities / tables, but also share 1 specific, common entity / table.
I.e. Entities required by application A, will never be required by application B, except for the common table, and vice versa. Now the common table has relatio...
Hi all,
I'd like to run a criteria query with lazy many-to-one associations. Those associations are set as lazy="false" in the HBM. It's because we use it eagerly 90% of the project.
But there are a few 'big' queries that should run as lazy="proxy".
HBM:
<many-to-one name="DestinationElement" class="X" column="DstElemId" not-null="tr...
We have a bunch of lookup tables that all share the same columns (ID,Code,Description, etc) and my co-worked just asked me if we could build a generic lookup.hbm.xml mapping file and use it as a base for all the other lookup tables. Does nhibernate support include files, or some other way to reference a common chunk of XML? I understan...
I have a little doubt for mapping of property in hbm file.
Sometimes I've mapped the string field of my db in this way:
<property name="MyPropName" column="MyColumnName" length="20" />
but the same mapping can be wrote in this way:
<property name="MyPropName" column="MyColumnName" type="String(20)" />
my question is...what's the b...