orm

ORM and Active Record Pattern in PHP?

Hi, There are two things that seem to be popular nowadays and I was wondering what are the pros and cons of using something like this: http://codeigniter.com/user_guide/database/active_record.html ? Another thing is ORM (Doctrine for instance). What are the benefits of using these? ...

django dynamic column query

i've got a dict generated at somewhere like this: d={ 'k1':'v1', 'k2':'v2', ... } and i want to build a query like: SomeModule.objects.filter( Q(k1=v1) | Q(k2=v2) | ... ) what should i do to build the query? ...

Relationships and Lazy Loading in SubSonic 3.0

Hello, I'm playing around with SubSonic 3.0 at the moment, and it looks really straight-forward (except that I still have to decide between SimpleRepository and ActiveRecord, but that's another story). However, as the documentation is a bit sparse, I am not sure if it supports foreign-relationships and lazy-loading. Essentially, I have...

Annotations to a grails relationship?

Looking for a way to include a conditional reference attached to a relation between two objects, for example class Person { String firstName String lastName static hasMany = [ readyNow: Role, readyLater : Role, emergencyReplacement: Role] static belongsTo = Role static constraints = { } String toString() { return firstName + " " + l...

Storing and editing key/value pairs in Grails?

I have a domain object in Grails that needs to store a set of key/value pairs for each instance. There should never be more then about 10 pairs. The users of the application have to be able to edit these key/value pairs. Right now I'm looking at storing the data in a HashMap for each instance of the domain class. While I think this will ...

ORMs and POCOs when having multiple Backends/DI - Architecture? AutoMapper?

Okay, the title is not saying too much, sorry. Essentially it's an Architecture Question about an Application that can have multiple database backends (Well, "Database" is loosely used here as it can mean anything from MSSQL to XML Files to an IList in Memory), essentially involving the Repository Pattern. I have a set of POCOs that ess...

How can I get a collection for a DTO member with nhibernate?

I need to get a collection property populated in a DTO and I'm having trouble finding any information on doing this. I tried to do it like this: ICriteria selectCriteria = Session.CreateCriteria<DataRun>() .SetProjection(Projections.ProjectionList() .Add(Projections.Property("SomeCollection"), "Collection"))...

When should I consider using an ORM framework?

I am developing an application which at the moment queries a (rather large) database via ADO.NET and hard-coded SQL statements. Admittedly this is ugly (i.e. no compile time errors thrown if a mistake is made in the SQL) and potentially dangerous (due to SQL injections, etc although this is unlikely to be a problem for this particular ap...

How to map a set of enum type in Hibernate?

In hibernate, is it possible to define a mapping for a class to a set of enums? I've been able to find examples of how to define mappings of Sets and I've been able to find separate examples for how to map Enums, but I cannot figure out how to define a of Enums for a class. Could anyone please provide me with an example? This is ...

What is the alternative to MVC and an ORM?

In the context of RoR and multiple disperate database connection, I was given this comment. What is my alternative on an Apache server (mac)? PHP, no MVC, and a mess? Also, this is not a comment about PHP. It just allows the classic asp mess that I have now, but fwiw, the "mess" works and has served well for many years. I wanted to ...

implementing "update if exists" in Doctrine ORM

I am trying to INSERT OR UPDATE IF EXISTS in one transaction. in mysql, I would generally use DUPLICATE KEY ("UPDATE ON DUPLICATE KEY".) I'm aware of many solutions to this problem using various sql variants and subqueries, but I'm trying to implement this in Doctrine (php ORM). It seems there would be Doctrine methods for doing this...

can you begin a mysql statement with "IF"?

I am trying to implement "IF record EXISTS THEN UPDATE ELSE INSERT" in mysql. Specifically, I have to figure out how to do that with Doctrine ORM. One solution using native MySql is to use "ON DUPLICATE KEY UPDATE". This is unfortunately not supported in Doctrine. Another semi solution is to use "REPLACE INTO" syntax. Doctrine sup...

What is the good ORM for .NET that does concurrency well?

I am looking for a well rounded ORM that handle concurrency with ease for .NET. It should also be threadsafe. Any recommendation? Pls elaborate why you choose this particular ORM. ...

What ORMs work well with Scala?

I'm about to write a Scala command-line application that relies on a MySQL database. I've been looking around for ORMs, and am having trouble finding one that will work well. The Lift ORM looks nice, but I'm not sure it can be decoupled from the entire Lift web framework. ActiveObjects also looks OK, but the author says that it may not ...

Can you find out if a Django Model instance is "dirty"?

I really like the feature of SQLAlchemy that allows you to see if an object is dirty: if it has been modified since it was retrieved from the database, or the last time it was saved. Is it possible to find this information from the Django ORM? Note this is not the same as Dirty fields in django, as I don't care about what the previous ...

Products Ranking

I need to sort some products base on user ratings. Suppose we have 3 products {a,b,c} and we have user's feed backs about this products. It's not important which user give us feed back (this question is not about correlative filtering if you are familiar with it - user interests is not the case here) Each of these below lines are feed ...

Should/can one generate a database schema of ones classes?

I have designed some classes using Visual Studio class diagramming. Now I would like to persist this data using ORM and maybe other persistence mechanisms. I am wondering if there is a way to generate the SQL based on the properties in my classes, since they fairly well represent the database structure needed. This would save me a lot of...

Scanning huge tables with SQLAlchemy using the ORM

I am currently playing around with SQLAlchemy a bit, which is really quite neat. For testing I created a huge table containing my pictures archive, indexed by SHA1 hashes (to remove duplicates :-)). Which was impressingly fast... For fun I did the equivalent of a select * over the resulting SQLite database: session = Session() for p i...

Can nhibernate/orm support eav?

I've recently inherited a system that relies heavily on an EAV database structure, and is really struggling from a performance perspective. What I want to do is use nhibernate or another suitable ORM product to map these EAV tables to entities in such a way that we can map a row to a property. We can then refactor the database in order ...

Use Google AppEngine datastore outside of AppEngine project

For my little framework Pyxer I would like to to be able to use the Google AppEngine datastores also outside of AppEngine projects, because I'm now used to this ORM pattern and for little quick hacks this is nice. I can not use Google AppEngine for all of my projects because of its's limitations in file size and number of files. A great...