orm

NHIbernate: Difference between Restriction.In and Restriction.InG

When creating a criteria in NHibernate I can use Restriction.In() or Restriction.InG() What is the difference between them? ...

Detach an entity from JPA/EJB3 persistence context

What would be the easiest way to detach a specific JPA Entity Bean that was acquired through an EntityManager. Alternatively, could I have a query return detached objects in the first place so they would essentially act as 'read only'? The reason why I want to do this is becuase I want to modify the data within the bean - with in my app...

Any thoughts on DevExpress XPO ORM Package?

XPO is the object relational mapper of choice at my company. Any thoughts on the pros and cons? ...

Adaptive Database

Are there any rapid Database protoyping tools that don't require me to declare a database schema, but rather create it based on the way I'm using my entities. For example, assuming an empty database (pseudo code): user1 = new User() // Creates the user table with a single id column user1.firstName = "Allain" // alters the table to hav...

Why @OneToMany does not work with inheritance in Hibernate

@Entity @Inheritance(strategy = InheritanceType.SINGLE_TABLE) public class Problem { @ManyToOne private Person person; } @Entity @DiscriminatorValue("UP") public class UglyProblem extends Problem {} @Entity public class Person { @OneToMany(mappedBy="person") private List< UglyProblem > problems; } I think it is pretty...

Suggestions on how to map from Domain (ORM) objects to Data Transfer Objects (DTO)

The current system that I am working on makes use of Castle Activerecord to provide ORM (Object Relational Mapping) between the Domain objects and the database. This is all well and good and at most times actually works well! The problem comes about with Castle Activerecords support for asynchronous execution, well, more specifically th...

Best practices for querying with NHibernate

I've come back to using NHibernate after using other technologies (CSLA and Subsonic) for a couple of years, and I'm finding the querying a bit frustrating, especially when compared to Subsonic. I was wondering what other approaches people are using? The Hibernate Query Language doesn't feel right to me, seems too much like writing SQL,...

Which ORM framework can best handle an MVCC database design?

When designing a database to use MVCC (Multi-Version Concurrency Control), you create tables with either a boolean field like "IsLatest" or an integer "VersionId", and you never do any updates, you only insert new records when things change. MVCC gives you automatic auditing for applications that require a detailed history, and it als...

Standard way to merge Entities in LlblGenPro

I start with an entity A with primary key A1, it has child collections B and C, but they are empty, because I haven't prefetched them. I now get a new occurrence of A (A prime) with primary key A1 with the child collections B and C filled. What is a good way to get the A and A prime to be the same object and to get A collections of B a...

Why is parameterized SQL generated by NHibernate just as fast as a stored procedure?

One of my co-workers claims that even though the execution path is cached, there is no way parameterized SQL generated from an ORM is as quick as a stored procedure. Any help with this stubborn developer? Edit: I won't pick an answer but instead vote up all the great replies ...

Good Features for an ORM

I'm currently working on putting together a fairly simple ORM tool to serve as a framework for various web projects for a client. Most of the projects are internal and will not require massive amounts of concurrency and all will go against SQL Server. I've suggested that they go with ORM tools like SubSonic, NHibernate, and a number of...

What to do with queries who don´t have a representation in a domain model?

This is not specific to any language, it´s just about best practices. I am using JPA/Hibernate (but it could be any other ORM solution) and I would like to know how do you guys deal with this situation: Let´s supose that you have a query returning something that is not represented by any of your domain classes. Do you create a specific c...

(N)Hibernate - is it possible to dynamically map multiple tables to the one class

I have the situation where i use GIS software which stores the information about GIS objects into separate database table for each type/class of GIS object (road, river, building, sea, ...) and keeps the metadata table in which it stores info about the class name and its DB table. Those GIS objects of different classes share some parame...

What are some good Python ORM solutions?

I'm evaluating and looking at using CherryPy for a project that's basically a javascript front-end from the client-side (browser) that talks to a Python web service on the back-end. So, I really need something fast and lightweight on the back-end that I can implement using Python that then speaks to the PostgreSQL db via an ORM (JSON to ...

How can you do paging with NHibernate?

For example, I want to populate a gridview control in an ASP.NET web page with only the data necessary for the # of rows displayed. How can NHibernate support this? ...

Anyone using the Entity Framework *Well*?

Has anyone actually shipped an Entity Framework project that does O/R mapping into conceptual classes that are quite different from the tables in the datastore? I mean collapse junction (M:M) tables into other entities to form Conceptual classes that exist in the business domain but are organized as multiple tables in the datastore. All...

When can/should you go whole hog with the ORM approach?

It seems to me that introducing an ORM tool is supposed to make your architecture cleaner, but for efficiency I've found myself bypassing it and iterating over a JDBC Result Set on occasion. This leads to an uncoordinated tangle of artifacts instead of a cleaner architecture. Is this because I'm applying the tool in an invalid Context,...

Old-school SQL DB access versus ORM (NHibernate, EF, et al). Who wins?

I've been successful with writing my own SQL access code with a combination of stored procedures and parameterized queries and a little wrapper library I've written to minimize the ADO.NET grunge. This has all worked very well for me in the past and I've been pretty productive with it. I'm heading into a new project--should I put my ol...

How to upgrade database schema built with an ORM tool?

I'm looking for a general solution for upgrading database schema with ORM tools, like JPOX or Hibernate. How do you do it in your projects? The first solution that comes to my mind is to create my own mechanism for upgrading databases, with SQL scripts doing all the work. But in this case I'll have to remember about creating new scripts...

Looking for better End-to-End Comms with Flex, .NET and DBMS

We're reviewing some of our practices at work - and the specific thing we're looking at right now is the best method for doing Comms with Flex based clients, and .NET web services. Our typical approach is to first model the interactions based on requirements, mock up some XML messages and sanity check them, turn those into XSDs, and fi...