mapping

nHibernate mapping for entity to multiple different parent entities (eg Addres -> Firm, Addres -> Client)

Can someone help me with the best way to map the following situation in fluent nHibernate? The Address class is used in both Client and Company. How can I store it most efficient in SQL? And what should the mapping look like? I've thought about multiple options, but I'm not experienced enough with nHibernate for these situations: use 1...

Get UNC Path for Mapped Drive VB.net

I neet to get UNC path from mapped drive. I tried to use WNetGetConnection, but it doesn't work for me. It returns error 487. Does anybody know how to deal with this error or any other way to get the UNC path? ...

Core Data migration of to-one relationship to to-many relationship

I have a deployed app that samples measurements from sensors (e.g., Temp °C, Pressure kPa). The user can create Experiments and collect samples. Each sample is stored as a Run, such that there is a one-to-many relationship from Experiment to Run. In the interest of performance, Run has a to-one relationship with Data entity (which is whe...

How to shortcut diamond character in vim

In the dictionary file, which I am editing I often need to insert character "◊" on place of <>. Is there a way to map "◊" to some key so that I press "r" for replace and then my_shortcut to have <> replaced by "◊"? I found a way to make imap mapping in .vimrc: :imap <> ◊ But changing to inset mode is sub-optimal, would that be possibl...

How to introduce multi-column constraint with JPA annotations?

I am trying to introduce a multi-key constraint on a JPA-mapped entity: public class InventoryItem { @Id private Long id; @Version private Long version; @ManyToOne @JoinColumn("productId") private Product product; @Column(nullable=false); private long serial; } Basically (product, serial) pair s...

Generic Aggregation of C++ Objects by Attribute When Attribute Name is Unknown at Runtime

I'm currently implementing a system with a number of class's representing objects such as client, business, product etc. Standard business logic. As one might expect each class has a number of standard attributes. I have a long list of essentially identical requirements such as: the ability to retrieve all business' whose industry is...

nHibernate Self Join Mapping

Hi Guys, This is probably incredibly simple, but I just cant see the wood for the trees at the moment. For brevity, I would like to model a word object, that has related words to it (synonyms), In doing so I could have the following mappings: <class name="Word" table="bs_word"> <id name="Id" column="WordId" type="Int32" unsaved-value=...

Dozer mapping for Hibernate object to DTO

Hello, I try to use Dozer to convert my domain entity to DTO objects. So, I want to convert PersistentList, PersistentBag, ... from my domain entity to ArrayList, ... in my DTO objects to avoid lazy problem. This is an example of two of my domain entity : public class User { private Collection<Role> roles; ... } public cl...

NHibernate How to specify custom sql type only in production

I am saving binary files into a Sql Server 2005 Db using Fluent NHibernate. However, I am using SQLite to run my (pseudo) Unit Tests. I need to use a custom Sql type for Ms Sql, but it would throw an error on SqlLite. What strategies can I use? This is the Map file: public class BinaryFile { public BinaryFile() { ...

DTO and mapper generation from Domain Objects

I have plenty of java domain objects that I need to transform to DTOs. Please, don't start with the anti-pattern thing, the Domain Objects are what they are because of a long history, and I can't modify them (or not too much, see below). So, of course, we've passed the age of doing all that manually. I've looked around, and dozer seems...

Dragging shapes in Java 3D with the mouse

I have a 3D scene in which i have objects i can interact with using the mouse. I use a pick ray and can correctly obtain the desired object (from the PickInfo object). The problem i am facing, is that i want to drag the object or distort it along the plane of the viewport and have it be positioned where my mouse actually is in the view...

language specific virtual keyboard with java

Hello everyone! I have to make an on-screen keyboard using JAVA on linux. the problem is it has to work on the most languages. for start, i need to et the current locale, that's clear, but after that, is there any way of getting the keyboard layout and maping of that locale? i searched for hours, but couldn't find a thing, so i really...

Return latitude/longitude based on entered address

I'm building a php based application for a client to enter in addresses for their customers' buildings. They'd like the ability to view the location on a map (either as individuals or grouped in a city search). What I'm trying to accomplish is a lookup once the address is entered into a form that populates the database, so after they en...

Fill object data from several tables using hibernate mapping

Hi all, I'd like to know if it is possible to fill up a class data from database using the hibernate hbm (mapping). For instance: public class someClass { List<OtherClass> otherClasses; List<YetAnotherClass> yetAnotherClasses; //Constructors ? class OtherClass { String name; //setters, ge...

NHibernate Query object collection issue

Hi, I am new to NHibernate and need some information regarding the internal working of the engine: I have a table called Student and the design is as follows: RollNo Name City Postcode and there are 5 more columns like this. I have School class and mappings associated with it. I am querying RollNo and Name using session as given be...

NIS password mapping question

I have NIS server with user "techsupport", which has uid/gid = 517 I've configured NIS and NFS on that server, as well as NFS/NIS client on the remote web server. Now I need to techsupport user to be able to login to web server using techsupport username, but HAVE root privileges. I need this, so I can easily track, which support agen...

Hibernate can't load Custom SQL collection

Hi, There is a table Item like, code,name 01,parent1 02,parent2 0101,child11 0102,child12 0201,child21 0202,child22 Create a java object and hbm xml to map the table.The Item.parent is a Item whose code is equal to the first two characters of its code : class Item{ String code; String name; Item parent; List<Item> ch...

Fluent NHibernate is bringing ClassMap Id and SubClassMap Id to referenced table?

HI, I have the following entities I'm trying to map: public class Product { public int ProductId { get; private set; } public string Name { get; set; } } public class SpecialProduct : Product { public ICollection<Option> Options { get; private set; } } public class Option { public int OptionId { get; private set; } } An...

Map element position in data file to class property

I need to read/write files, following a format provided by a third party specification. The specification itself is pretty simple: it says the position and the size of the data that will be saved in the file. For example: Position Size Description -------------------------------------------------- 0001 10 ...

Fluent composite foreign key mapping

Hi, I wonder if this is possible to map the following with fluent nhibernate: A document table and a document_revision table will be the target tables. The document_revision table should have a composite unique key consisting of the document_id and the revision number (where the document_id is also the foreign key to the document tabl...