mapping

Mapping two tables 0..n in Hibernate

I have a table Users CREATE TABLE "USERS" ( "ID" NUMBER NOT NULL , "LOGINNAME" VARCHAR2 (150) NOT NULL ) and I have a second table SpecialUsers. No UserId can occur twice in the SpecialUsers table, and only a small subset of the ids of users in the Users table are contained in the SpecialUsers table. CREATE TABLE "SPECIALU...

How do you map a "Map" in hibernate using annotations?

Using annotations how do you map a field in an entity which is a "Map" (Hashtable) of String to a given object? The object is annotated and instances of it are already stored in the hibernate databse. I've found the syntax for definging a map with a simple key and value as such: <class name="Foo" table="foo"> ... <map role="age...

elegant way to map two arrays to each other

I've got two arrays, one with IDs and one with Names: $ids = array(4, 13, 6, 8, 10); $names = array('alice', 'bob', 'charles', 'david', 'elizabeth'); I need to update the db so that the rows with the ids have the names in the array. Here's the tricky bit: I also have two ints: $special_name = 2; // the index in $names, in this case w...

Finding places of interest, based on approx geo location.

Hi folks, I was wondering if it is possible to get the places of interest in a location based on the lattitude/longitude information or approximate street address gathered from a GPS system? places of interest are defined in this context as: Restaurants, Resorts, Parks, malls, movie theaters, etc. Are there some online services either...

EF Mapping and metadata information could not be found for EntityType Error

Hi, I have encountered an exception when I using Entity Framework 4.0 RC. My Entity Framework model is encapsulated in a private assembly whos name is Procurement.EFDataProvider and my POCO are inside of another assembly Procurement.Core The relation between Core(Business Logic)and EFDataProvider(Data Access) is with a factory named Data...

SQLAlchemy - Problem with an association table and dates in primary join

Hi, I am working on defining my mapping with SQLAlchemy and I am pretty much done except one thing. I have a 'resource' object and an association table 'relation' with several properties and a relationship between 2 resources. What I have been trying to do almost successfully so far, is to provide on the resource object 2 properties: pa...

Commercial Mapping software - South Africa

Hi, I am looking for a good quality and reliable mapping solution for South Africa. We require similar functionality to Bing and Google. ie plotting markers on the map, geocoding, drawing polygons, popups on the map showing content etc. So far Google maps looks like the winner, but are there other options that you would recommend. th...

Incorrect field type mapping SubSonic 2.2, SQLite 3

I have a boolean (BOOL) type field in the SQLite table. In the SubSonic generated DAL it is represented as string (instead of bool). It is weird. How it can be managed? Please, help. ...

Custom Identity Types in Mapping

I have an application where the identity column is stored as an Oracle VARCHAR2(50 BYTE) but is actually a Guid. I want my model to expose it as a Guid: class Foo { public Guid Id { get; set; } } Using Fluent NHibernate I don't see a CustomTypeIs() method on the IIdentityPart. I would think it would be something similar to an I...

How to dynamcially call a generic method based on a mapping in a dictionary?

I have a method String Foo<T> where T: WebControl Now I do have a string like "hyperlink". What is want is to call Foo<Hyperlink> based on a mapping from the string to the generic. How does the dictionary have to look like? It ain't: private Dictionary<string, Type> _mapping = new Dictionary<string, Type>() { {"hyperlink", ty...

Retrieving distinct values in mapping

I have an existing view which has too much data in it. Unfortunately I cannot get rid of it so I need to try to work around it using my NHibernate mapping. The idea is to have NH issue the following query: SELECT DISTINCT User_Id, Module_Id, Application_Id, RightsMask FROM V_UserApplicationPermissions WHERE User_Id = ? My current ma...

Map external directory to web.xml

Is there an easy way to map a directory in the web.xml or other deployment descriptor (jetty.xml, etc) files? For example, if I have a directory /opt/files/ is there a way that I can access its files and sub-directories by visiting http://localhost/some-mapping/? It strikes me that there should be some simple way of doing this, but I ha...

Python Naming Conventions for Dictionaries/Maps/Hashes

While other questions have tackled the broader category of sequences and modules, I ask this very specific question: "What naming convention do you use for dictionaries and why?" Some naming convention samples I have been considering: # 'value' is the data type stored in the map, while 'key' is the type of key value_for_key={key1:valu...

Hibernate best approach for one Java class and multiple tables?

Put another way: How do you model/map a heavily reused child class/table to many different parent entities? I have several entity types each being persisted into its own table: class A --> table A class B --> table B .... Now I need to make each of these classes the parent of a 1:M unidirectional child collection. The collection is a...

intelligent mapping of Class keys

Hi, I have created a simple API to convert arbitrary objects into human-readable strings. Think of it as a generalized String.valueOf() functionality. The API achieves this by selecting an public interface ObjectFormatter { public String format(Object object); public Class getObjectClass(); public boolean offe...

Mapping a child collection without indexing based on database primary key or using bag

I have a existing parent-child relationship I am trying to map in Fluent Nhibernate: [RatingCollection] --> [Rating] Rating Collection has: ID (database generated ID) Code Name Rating has: ID (database generated id) Rating Collection ID Code Name I have been trying to figure out which permutation of HasMany makes sense here. W...

Wide and narrow versions of an entity mapped to one table in Entity Framework

In some scenarios I need a "wide" version of an entity with many properties (say FullCustomer) while in other scenarios it's enough with a "narrow" version with few properties (say MiniCustomer), how could I map these two entities, FullCustomer and MiniCustomer, to the same Customer table in the database? Furthermore, I need to be able t...

When does it make sense to use a map?

I am trying to round up cases when it makes sense to use a map (set of key-value entries). So far I have two categories (see below). Assuming more exist, what are they? Please limit each answer to one unique category and put up an example. Property values (like a bean) age -> 30 sex -> male loc -> calgary Presence, with O(1) pe...

Select points on a map

I am just beginning design work on a problem that I'm sure has been solved before. In a web based application, I need to: a) present a map b) place a set of points (map-pins) on the map c) allow the user at his browser to draw a simple closed curve on the map with his mouse d) send the path of that curve back to the server e) on the ...

how to get latitude and longitude for particular landmark?

how to get latitude and longitude for particular landmark/business, i would like to get lat/long for specific address how to i do that? shall i use gps device to get the lat/long? ...