I'm mapping a set of tables that share a common set of fields:
So as you can see I'm using a table-per-concrete-type strategy to map the inheritance.
But...
I have not could to relate them to an abstract type containing these common properties.
It's possible to do it using EF?
BONUS: The only non documented Entity Data Model Map...
I think I probably know that the most common suggestion will be "change the database schema" but unfortunately it's one of those "I'm stuck with a legacy database" situations.
Basically I want to map the following using Fluent NHibernate
CREATE TABLE Person (PersonId int)
CREATE TABLE Organisation (OrganisationId int)
CREATE TABLE Ow...
I want to map sth like this using fluent Nhibernate but I am not sure how to map the inventory table
This is the tables I have :
Product (Id,Name, ...)
Warehouse(Id, Name, ...)
Inventory(Product_id, Warehouse_id, StockInHand)
I have map the Product and Warehouse like below
Public ProductMap()
{
Id(x => x.Id);
...
Lets suppose that I have a Category table with a column that holds the id of a parent or child category from the same table. This design would allow me to have unlimited levels of Categories, or unlimited levels in a thread, for example.
How can I map this relationship with NHibernate? Are there any disadvantages or warnings that I shou...
Let's say your have the following table structure:
==============================
| Case |
==============================
| Id | int |
| ReferralType | varchar(10) |
+---------| ReferralId | int ...
Hi,
I' ve got 2 tables... Challenge and ChallengeYear, ChallengeYear is only to create a list of years in challenge.
I only want to make Challenge an entity, containing a list of List years. Is this possible?
I've looked in to @SecondaryTable together with @JoinColumn and @OneToMany, but neither of those can do the trick, or i am ove...
I have a join table where the original table is a numeric type and the join table key column is a string type. Legacy decision that I am trying to avoid having to change to minimize the risk to the scope of work.
HasManyToMany<Attachment>(x => x.Attachments)
.Table("ObjectAttachments")
.ParentKeyColumn("ObjectId")
.ChildKeyColumn...
I am looking to persist user preferences into a collection of name value pairs, where the value may be an int, bool, or string.
There are a few ways to skin this cat, but the most convenient method I can think of is something like this:
public class User
{
public virtual IDictionary<string, object> Preferences { get; set; }
}
wit...
Hi *,
for my current project I am using Castle's ActiveRecord in C#. For one of my tables I do need to use a custom type class (dealing with an stupid time to timespan conversion). To keep my code clean I like to define the class which is derived from IUserType within the object mapping class. But I can find no way to map this property ...
I'm getting the error "Illegal acces to loading collection" when i'm trying to get a list of variants belonging to a certain product. The NHibernate mapping is as below;
<list name="Variants" lazy="false" cascade="save-update" inverse="false" table="PluginProduct_ProductVariant">
<key column="ProductId" />
<index column="Ordinal" />...
I am trying to retrieve the individual detail rows without having to create an object for the parent. I have a map which joins a parent table with the detail to achieve this:
Table("UdfTemplate");
Id(x => x.Id, "Template_Id");
Map(x => x.FieldCode, "Field_Code");
Map(x => x.ClientId, "Client_Id");
Join("UdfFields", join =>
{
join....
I want to use a custom sequence generator in my application, but the entity is located in a domain model jar that is shared with other applications. Apparently entity annotations can be overridden in orm.xml but I can't figure out the proper XML incantation to get this to work.
I can modify the annotation in the entity like this this:
...
Hi all,
I am trying to create a mapping file for the following Model using Fluent NHibernate. But, I am not sure of how to do the mapping for the List<string> in the mapping file.
public class MyClass
{
public virtual Guid Id { get; set; }
public virtual string Name { get; set; }
public virtual List<stri...
Hi, I'm quite new to hibernate and have stumbled on this problem, which I can't find solution for.
When persisting parent object (with one-to-many relationship with child), the foreign-key to this parent is not stored in child's table.
My classes:
Parent.java
@javax.persistence.Table(name = "PARENT")
@Entity
public class PARENT {
p...
Hi
I am trying to create a plugin for dotCMS. My plugin stores data in database. i defined hibernate mapping file and put in my plugin folder's conf dir and i have no idea how to hibernate generate models based my mapping definition. I am using hello world plugin's mapping file for mysql
Any help or comment would be highly appreciated
...
I recently ran across several objects implemented to handle events with a hard coded mapping using this pattern:
public void handleEvent(Event event)
{
if(event.getCode() == SOME_STATIC_EVENT)
doSomething(event);
if(event.getCode() == ANOTHER_STATIC_EVENT)
doSomethingElse(event);
}
where doSomething functions a...
I have a question concerning a good strategy on how to fill a data "bean" with data inside an xml file.
The bean might look like this:
class Person
{
var $id;
var $forename = "";
var $surname = "";
var $bio = new Biography();
}
class Biography
{
var $url = "";
var $id;
}
the xml subtree containing the info might look lik...
my issue lokks similar to this one: (link)
but i have one-to-many association:
<set name="Fields" cascade="all-delete-orphan" lazy="false" inverse="true">
<key column="[TEMPLATE_ID]"></key>
<one-to-many class="MyNamespace.Field, MyLibrary"/>
</set>
(i also tried to use )
this mapping is for Template object. this one and the Field...
Hi,
I am looking for some service that can transform GPS coordinates into XY coordinates so that I can plot a point on an Image. Something like fromLatLngToContainerPixel would be great.
Thanks in advance.
P.S. I am developing a desktop application in java.
...
I mapped some classes to some tables with hibernate in Java, i set Hibernate to show SQL, it opens the session, it shows that it does the SQL, it closes the session but there are no modifications to the database.
Entity
public class Profesor implements Comparable<Profesor> {
private int id;
private String nume;
private String prenume;
...