mapping

How do you map the identity column in the results of a stored procedure?

We're using NHibernate.Mapping.Attributes to do our mappings. In order to get NHibernate to populate a data object automatically, it appears that you need to allow for an identity column. Okay, no problem, I added a (fake) PK column to my stored procedure results (it's a report query, so the identifier doesn't need to mean anything as l...

Fluent NHibernate: Entity from one table, but reference will map to another tables?

Given the following tables: Product ----------- ProductId : int (PK) ProductVersion : int ProductHistory ----------- ProductId : int (PK) ProductVersion : int (PK) Item ----------- ItemId : int (PK) ProductId : int (FK) -- ProductId + ProductVersion relates to ProductHistory ProductVersion : int (FK) And the following cl...

NHibernate mapping one table on two classes with where selection

We would like to map a single table on two classes with NHibernate. The mapping has to be dynamically depending on the value of a column. Here's a simple example to make it a bit clearer: We have a table called Person with the columns id, Name and Sex. The data from this table should be mapped either on the class Male or on the cla...

Removing google map markers using JQuery

Hi All, I've searched hi and low for info regarding this but to no avail. Basically I have a page that is loading a bunch of cateories as checkboxes, for example checkbox 1 is called 'Exhibitions' and when clicked on displays all the exhibitions on the map (I am passing the value of the checkbox to the JQuery function which then filter...

Tiles 2 And No mapping found for HTTP request with URI - Spring-MVC

I want to use Spring-Tiles intergration. Here you can see how my app looks like. So my question is: why Spring-MVC dispatcher Servlet can not resolve my Target page ??? ...

Offline Mapping API

Are there any services available that allow me to manipulate maps in an offline setting? I am working on a project that requires me to take a map and based on features on the map, generate a game world. I have looked at a few of the API's for different providers: Google, ms, etc. The API's I looked seem to be strictly showing a user a ma...

How to map (large) integer on (small in size( alphanumeric string with PHP? (Cantor?)

Dear all, I can't figure out how to optimally do the following in PHP: In a database, I have messages with a unique ID, like 19041985. Now, I want to refer to these messages in a short-url service but not using generated hashes but by simply 'calculate' the original ID. In other words, for example: http://short.url/sYsn7 should let me ...

NHibernate mapping with no empty constructor and no setters

I'm testing how difficult it is to use NHibernate with a domain that is completely unaware of it and isn't bent to accodomate any limitations. On many examples I found on the web the domain being mapped is yet another example of an anemic domain, where objects don't go far from being simple data holders. Sure, this makes the mapping sim...

Need to map classes to different databases at runtime in Hibernate

I have MainDB database and unknown number (at compile time) of UserDB_1, ..., UserDB_N databases. MainDB contains names of those UserDB databases in some table (new UserDB can be created at runtime). All UserDB have exactly the same table names and fields. How to handle such situation in Hibernate? (database structure cannot be change...

nHibernate storage of an object with self referencing many children and many parents

I have an object called MyItem that references children in the same item. How do I set up an nhibernate mapping file to store this item. public class MyItem { public virtual string Id {get;set;} public virtual string Name {get;set;} public virtual string Version {get;set;} public virtual IList<MyItem> Children {g...

Type-safe mapping from Class<T> to Thing<T>

I want to make a map-kind of container that has the following interface: public <T> Thing<T> get(Class<T> clazz); public <T> void put(Class<T> clazz, Thing<T> thing); The interesting point is that the Ts in each Class<T> -> Thing<T> pair is the same T, but the container should be able to hold many different types of pairs. Initially I...

Using Castor, how do you map Java class "java.util.ArrayList" to element "ArrayList", but also generate elements for the objects that it contains?

Using Castor, how do you map Java class java.util.ArrayList to element <ArrayList/> instead of <array-list/> while still including the elements that it contains? For example, the class mapping <class name="java.util.ArrayList"> <map-to xml="ArrayList" /> </class> maps an ArrayList object to an empty element, omitting elements fo...

How change Castor mapping to remove "xmlns:xsi" and "xsi:type" attributes from element in XML output?

How do I change the Castor mapping <?xml version="1.0"?> <!DOCTYPE mapping PUBLIC "-//EXOLAB/Castor Mapping DTD Version 1.0//EN" "http://castor.org/mapping.dtd"&gt; <mapping> <class name="java.util.ArrayList" auto-complete="true"> <map-to xml="ArrayList" /> </class> <class name="com.db.spgit...

How to map inheritance with property returned other inheritance?

Hi I have abstract class Vehicle and two classes that derive from: Car and ForkLift. public abstract class Vehicle { public EngineBase Engine { get; set; } } public class Car : Vehicle { public GasEngine Engine { get; set; } } public class ForkLift : Vehicle { public ElectricEngine Engine { get; set; } } and Engine clas...

How to create a "dependency graph" for IT assets

One of my customers is trying to create an interactive "matrix" of interdependencies for the various applications used in their company (it's a travel&leisure company with around 2500 employees). The idea (still at the prototype stage) is to create a sort of Map, based on Visio or similar tool, which traces the communication and interde...

transform longitude latitude into meters

I need a function that maps gps positions to x/y values like this: getXYpos(GeoPoint relativeNullPoint, GeoPoint p){ deltaLatitude=p.latitude-relativeNullPoint.latitude; deltaLongitude=p.longitude-relativeNullPoint.longitude; ... resultX=latitude (or west to east) distance in meters from p to relativeNullPoint resultY=lon...

Fluent Nhibernate mapping related items

I am trying to relate 2 items. I have a table that is simply an Id field, and then 2 columns for the Item Id's to relate. I want it to be a 2 way relationship - that is, if the items appear twice in the table, I only want one relationship connection back. So, here's my item: public class Item { public virtual Guid ItemId {get; set;...

How to order a HasMany collection by a child property with Fluent NHibernate mapping

I am using Fluent NHibernate to map the following classes: public abstract class DomainObject { public virtual int Id { get; protected internal set; } } public class Attribute { public virtual string Name { get; set; } } public class AttributeRule { public virtual Attribute Attribute { get; set; } public virtual Statio...

EntityFramework: Access dabase-column using user defined Type

I "inherited" an old Database where dates are stored as Int32 values (times too, but dates shall suffice for this example) i.e. 20090101 for Jan. 1st 2009. I can not change the schema of this database because it is still accessed by the old programs. However I want to write a new program using EF as the O/R-M. Now I'd love to have DateTi...

Mapping Vectors

Is there a good way to map vectors? Here's an example of what I mean: vec0 = [0,0,0,0,0,0,0,0,0,0,0] vec1 = [1,4,2,7,3,2] vec2 = [0,0,0,0,0,0,0,0,0] vec2 = [7,2,7,9,9,6,1,0,4] vec4 = [0,0,0,0,0,0] mainvec = [0,0,0,0,0,0,0,0,0,0,0,1,4,2,7,3,2,0,0,0,0,0,0,0,0,0,7,2,7,9,9,6,1,0,4,0,0,0,0,0,0] Lets say mainvec doesn't exist (I'm just sho...