mapping

design of orm tool

Hello , I want to design a orm tool for my daily work, but I'm always worry about the mapping of foreign key. Here's part of my code: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Data; namespace OrmTool { [AttributeUsage(AttributeTargets.Property)] public class ColumnAttrib...

Mapping an instance of IList in NHibernate

I'm trying to map a parent-child relationship using NHibernate (2.1.2), MySql.Data (6.2.2) and MySQL Server (5.1). I figured out that this must be done using a <bag> in the mapping file. I build a test app which is running without yielding any errors and is doing an insert for each entry but somehow the foreign key inside the children ta...

how to force nhibernate to set the foreign key of the child item?

i have a collection in the mapping: <bag name="Values" cascade="all-delete-orphan" lazy="false" inverse="true"> <key column="[TemplateId]"/> <one-to-many class="MyNamespace.Value, MyLib"/> </bag> the Value object has a foreign key [TemplateId]. both entities has their generator set to "identity". when i call session.Save() for th...

Best practice when removing entity regarding mappedBy collections?

I'm still kind of undecided which is the best practice to handle em.remove(entity) with this entity being in several collections mapped using mappedBy in JPA. Consider an entity like a Property that references three other entities: a Descriptor, a BusinessObject and a Level entity. The mapping is defined using @ManyToOne in the Property...

How to map EnumSet (or List of Enums) in an entity using JPA2

I have entity Person: @Entity @Table(schema="", name="PERSON") public class Person { List<PaymentType> paymentTypesList; //some other fields //getters and setters and other logic } and I have enum PaymentType: public enum PaymentType { FIXED, CO_FINANCED, DETERMINED; } how to persist Person and its list of enums (in...

In the UK, how do I find an address given the GPS coordinates?

Sorry this is not a very well defined question, I am thinking about an idea for a product, so need to know what is possible... Say I am standing at the fount door of a house, given the GSP coordinates from a smart phone, how can I find the address I am standing at? Is GPS good enough for this? How much does the data/service I need to ...

Use single static image as map

I have a single image (a flattened out image of the world map), I want to be able to plot some coordinates in this image without having to create a map server or whatever per se, Idon't know where to begin, whats the easiest approach ...

Problems Mapping a List of Serializable Objets with JDO

I have two classes Invoice and InvoiceItem. I would like Invoice to have a List of InvoiceItem Objets. I have red that the list must be of primitive or serializable objects. I have made InvoiceItem Serializable. Invoice.java looks like import java.util.ArrayList; import java.util.Date; import java.util.List; import javax.jdo.annotatio...

Fluent nHibernate and mapping IDictionary<DaysOfWeek,IDictionay<int, decimal>> how to?

Hello, I have problem with making mapping of classes with propert of type Dictionary and value in it of type Dictionary too, like this: public class Class1 { public virtual int Id { get; set; } public virtual IDictionary<DayOfWeek, IDictionary<int, decimal>> Class1Dictionary { get; set; } } My mapping looks like this: ...

Self-reference entity in Hibernate

Hi guys, I have an Action entity, that can have other Action objects as child in a bidirectional one-to-many relationship. The problem is that Hibernate outputs the following exception: "Repeated column in mapping for collection: DbAction.childs column: actionId" Below the code of the mapping: <?xml version="1.0"?> <!DOCTYPE hiberna...

Hibernate: What's wrong with this mapping to a subclass joined on foreign key?

I am experimenting with Hibernate to gain experience. I created a class Person with two subclasses: Student and Worker: public abstract class Person { private Long id; ... } public class Student extends Person { ... } Another class, Employer, has a bidirectional one-to-many relationship with Worker. public class Worker exten...

Choropleth mapping issue in R

EDIT: I have realized the source of my problem. I only have count information for the counties which I have data for, which is less than the number of counties in the area I'm plotting against. It stands to reason that the problem lines of code are here: mapnames <- map("county",plot=FALSE)[4]$names colorsmatched <- d$colorBuckets [na....

Library that supports KML?

I'm looking for a library that can be used to develop an application that supports KML. Basically I'm looking for what Google Earth does for 3D visualizations using KML. Is there such a library? ...

Strategy for migrating to NHibernate

Hi, I have a homebrew "ORM" solution that I want to migrate to nhibernate, but I can't seem to find a solution to the inheritence mapping I use and a matching one i NH. Here is what my current solution looks like: Example one to many: Type1 "1 - *" Type2 Type2 - Type1Id If there is inheritance on Type1 then in Type2 I have a seco...

NHibernate Mapping problem

My database is being driven by my NHibernate mapping files. I have a Category class that looks like the following : public class Category { public Category() : this("") { } public Category(string name) { Name = name; SubCategories = new List<Category>(); Products = new HashSet<Produ...

NHibernate: update item in list from an Interceptor

hi When i try to update a property on a item that is in a list from an interceptor, the update is not persisted. Is this possible at all? or am i doing something wrong? The child is mapped as a list of composite elements. The context is, i am trying to enforce read consistency for aggregates using Read committed isolation level and ...

Common Mercator Projection formulas for Google Maps not working correctly

I am building a Tile Overlay server for Google maps in C#, and have found a few different code examples for calculating Y from Latitude. After getting them to work in general, I started to notice certain cases where the overlays were not lining up properly. To test this, I made a test harness to compare Google Map's Mercator LatToY con...

Mapping A Sphere To A Cube

There is a special way of mapping a cube to a sphere described here: http://mathproofs.blogspot.com/2005/07/mapping-cube-to-sphere.html It is not your basic "normalize the point and you're done" approach and gives a much more evenly spaced mapping. I've tried to do the inverse of the mapping going from sphere coords to cube coords and ...

Suggestions for duplicate file finder algorithm (using C)

Hello, I wanted to write a program that test if two files are duplicates (have exactly the same content). First I test if the files have the same sizes, and if they have i start to compare their contents. My first idea, was to "split" the files into fixed size blocks, then start a thread for every block, fseek to startup character of ev...

Getting consecutive version numbers from Hibernate's @Version usage once per transaction

We use Hibernate with the following version definition for optimistic locking et. al: <version name="version" access="field" column="VERSION" type="long" unsaved-value="negative"/> This is fine and dandy; however, there is one small problem, which is that the first version for some entities is '0', and for others, it is '1'. Why this...