orm

Django-like queries in Java/JPA

Is there any library or framework to make JPA queries in a less verbose way such as: User.query("age < 30") instead of: Query query = entityManager.createQuery("select u FROM User u WHERE age < 30"); return query.getResultList(); I suppose there is no standard way to do it with JPA. I've seen Hibernate Criteria API, that is not as...

What ORMs are developers using to connect to Azure?

Hi, Im interested to find out what techniques developers are using to connect to a Windows Azure instance running in the cloud? From what i understand it is very similar to SQL Server with two of the key differences being Multiple Active Recordsets are not supported and idle/long running connections are automatically terminated by azu...

Eclipse plugins for Spring / Hibernate development?

I have a running dynamic web project in Eclipse (Java EE + Maven + Spring). I am at the point where I need to integrate a persistence layer and want to use Hibernate with a mySql database. I am wonder what plugins would be useful for me at this point? For Hibernate should I install hibernate tools or is it not necessary? Are then any ...

JPA Secondary Table Issue

I have a three tables: User, Course, and Test. Course has a User foreign key and Test has a Course foreign key. I am having trouble mapping the Test collection for each User since I need an intermediary step from User -> Course -> Test. I am trying to use a SecondaryTable since the User key for the Test is its associated Course row. A...

LINQ, repository pattern and many-to-many relations

Hello, I've a problem with saving changes to database, I'm using LINQ2SQL mapping. I've implemented M:M relation (User <= UserRole => Role) based on tutorial: http://www.codeproject.com/KB/linq/linqtutorial2.aspx#premain25 Everything works fine when I'm using one class which is inherits from DataContext and is responsible for all of m...

Is it possible to mix orm.xml definitions with annotations when using JPA/hibernate ?

I'm working on an application whihc supports using several DB vendors, with the table definitions being different for each DB type. The trouble is that the column definitions are not what hibernate expects, and so my entities contain a lot of @Column(..columnDefintion="..."...) annotations. To further complicate the issue, there's no wa...

Can Django ORM do an ORDER BY on a specific value of a column?

I have a table 'tickets' with the following columns id - primary key - auto increment title - varchar(256) status - smallint(6) - Can have any value between 1 and 5, handled by Django When I'll do a SELECT * I want the rows with status = 4 at the top, the other records will follow them. It can be achieved by the following query: sel...

NHibernate latency is very high

I am using NHibernate for ORM and have consolidated the loading of lots of entities into one big query. I am actually loading a word dictionary, around 500K entries, and each word relates to others. Running the loading process in the background could be very tricky in our application, as we would have to manually load an entry that has ...

Modelling a Two to Many Relationship in JPA/Hibernate

Hi folks, I have the following entity relationship problem. A "Game" must have two (and only two) "Team" objects. A "Team" can have many "Games" This, as far as I can see is a Two-to-Many relationship. However...I don't know how to model this in JPA. Eg, I was going to do something like this... @Entity public class Team extends BaseOb...

Lazy loading in Hibernate

My Java Web application uses Hibernate to perform ORM. In some of my objects, I use lazy loading to avoid getting data until I absolutely need it. The problem is that I load the initial object in a session, and then that session is destroyed. When I later attempt to resolve the lazy-loaded collections in my object I get the following err...

Form Level Validation in Zend Framework

I am using the Zend MVC framework along with an ORM layer generated with Propel, and I'm trying to figure out the best way to catch exceptions from a Propel object's save() function, and throw them to the Zend Form as errors. Not all of the exceptions that come out of the Propel object have a way to identify which field caused the error...

SQLAlchemy ORM Inserting Related Objects without Selecting Them

In the SQLAlchemy ORM tutorial, it describes the process of creating object relations roughly as follows. Let's pretend I have a table Articles, a table Keywords, and a table Articles_Keywords which creates a many-many relationship. article = meta.Session.query(Article).filter(id=1).one() keyword1 = meta.Session.query(Keyword).filter(i...

How to define index by several columns in hibernate entity?

Morning. I need to add indexing in hibernate entity. As I know it is possible to do using @Index annotation to specify index for separate column but I need an index for several fields of entity. I've googled and found jboss annotation @Table, that allows to do this (by specification). But (I don't know why) this functionality doesn't w...

subsonic with oracle database

Can anyone advise on the best Oracle ASP.NET 3.5 ORM in the land..pros and cons? How good is Subsonic 3.0 with Oracle? Thanks ...

Is there a Query-Mapper like iBATIS.NET but with dirty tracking, lazy-loading and cascading updates?

The problem: A DBA-controlled database with a Stored Procedure-only mandate. An expectation that the domain be defined in POCO's. So I decided that I need an ORM designed for stored procedures and/or legacy databases. Ideally the ORM should allow me to declaratively (or fluently) map domain objects to CRUD stored procedures. Some f...

Different versions of the same entity type (any ORM) for different roles/authorization levels.

Consider, for example: public interface IStaff { FullName name { get; set; } EMailAddress email_address { get; set; } SocialInsuranceId ssn { get; set; } PositiveInt age { get; set; } Address home_address { get; set; } } For some users, the viewmodel will only require name and email_address. Others may have a view...

Fluent NHibernate Many-to-many mapping with auto-generated pk instead of composite key

I'm working on a RoleProvider in .NET, using Fluent NHibernate to map tables in an Oracle 9.2 database. The problem is that the many-to-many table connecting users and roles uses a primary key generated from a sequence, as opposed to a composite key. I can't really change this, because I'm writing it to be implemented in a larger exist...

Considerations for implementing LINQ to SQL or Entity Framework now, intending to use NHibernate later

I've got a deadline for an initial release of a client-server application that will have lots of iterative releases subsequently. NHibernate is the ORM of choice, largely by reputation and my desire to gain experience with it. The problem is that I haven't even had a chance to spike NHibernate yet, and I'm afraid that doing so is going...

Does type projection have an opposite, or is it still projection (or just mapping)?

This is based on my assumption that taking an object of type: public class Fruit : IBasicFruit, IFruitDetails { // IBasicFruit implementation public string name { get; set; } public string color { get; set; } // IFruitDetails implementation public string scientific_name { get; set; } public bool often_mistaken_f...

Specific Subsonic Queries Not Working on SQL Server 2000

I'm using Subsonic 3 and am just starting the process of putting my application into production. Locally, I develop using SQL Server 2008 but the production environment is using SQL Server 2000. I am getting the following error for paging: 'ROW_NUMBER' is not a recognized function name. Description: An unhandled exception occurred du...