orm

SQL portability gotchas

My company has me working on finishing a back end for Oracle for a Python ORM. I'm amazed at how much differently RDBMSes do things even for the simple stuff. I've learned a lot about the differences between Oracle and other RDBMSes. Just out of sheer curiosity, I'd like to learn more. What are some common "gotchas" in terms of portin...

Django ORM equivalent

Hi all, I have the following code in a view to get some of the information on the account to display. I tried for hours to get this to work via ORM but couldn't make it work. I ended up doing it in raw SQL but what I want isn't very complex. I'm certain it's possible to do with ORM. In the end, I just want to populate the dictionary a...

Collection not populated with Fluent NHibernate

I am having an odd error when using Fluent NHibernate. I have an entity object called Module that is my "aggregate root" if you will. I created and tested my mappings for the Module class and the various related classes and tried creating a Module with all of its fields filled out and saving it. This worked correctly. My problem is w...

Propel custom Setter with SQL-specific stuff

Hello stackoverflow gurus I am using Propel 1.2 in a Symfony 1.0 project, with PostgreSQL db. I can use Criteria::CUSTOM in SELECT statements in order to use Postgres functions, like this (fulltext search): `$c = new Criteria(); $c->add(MyTablePeer::FULLTEXT_COLUMN, MyTablePeer::FULLTEXT_COLUMN." @@ to_tsquery('english', 'text to sear...

Is there any PHP ORM similar to Ruby`s DataMapper ?

I working mostly with DataMapper in Ruby and Merb, so im looking for PHP ORM that is similar to DataMapper. Any good ones? ...

OR/M and Sql 2008 table value parameters

By edict, we're using stored procedures for all interactions with our database. By organizational directive, we're using table value parameters in some of these stored procedures, specifically the ones I need to use. By legal edict, we can't use nHibernate or anything under LGPL (though, if necessary, we can fight back on that). Are t...

What's the current state of ORMs?

Historically I've been completely against using ORMS for all but the most basics applications. My reasoning has and always has been that it's a very leaky abstraction ... mostly because SQL provides a very powerful way to retreive data from a relational source which usually gets messed up by the ORM so that you lost a lot of performance...

Hibernate Error: org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session

I have two user Objects and while I try to save the object using sessio.save(userObj) I am getting the following error : Caused by: org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: [com.pojo.rtrequests.User#com.pojo.rtrequests.User@d079b40b] I am cre...

Should we use foreign-key constraints when persisting Domain Models?

A while ago I had a discussion with my colleagues about the persistence of Domain Models and whether we should enforce foreign-key constraints at the database level. My first reaction was that the very use of a relational database implied the enforcement of such constraints, but some argued that the database should be seen as nothing bu...

Protecting against SQL tablename injection - how far is too far?

I'm developing a relatively small application to talk to PostgreSQL, and wanted to get some feedback on how far is too far to go with regards to protecting against SQL injection. The application is in Perl and does not use any ORM modules (just DBI). The SQL statements are constructed in the typical fashion with placeholders: my $sql ...

What's the meaning of ORM?

Hi All! I ever developed several projects based on python framework Django. And it greatly improved my production. But when the project was released and there are more and more visitors the db becomes the bottleneck of the performance. I try to address the issue, and find that it's ORM(django) to make it become so slow. Why? Because Dja...

Lazy loading relationships in Django (and other MVCs/ORMs)

Interested in knowing how lazy loading is achieved in frameworks like Django. When is the decision made to perform the join? And is there a way to force eager loading in Django? Are there times when you would need to force Django to eager load? ...

Is it worth use ORM with Stored Procedures

My company's polices forces to use only stored procedures (SP) to talk with DB (no dynamic execution of SELECT, VIEWS on app side available) Business objects (BO) are fetched from DB. There is implemented simple BO-DB mapper using SQL Reader and this seems working well. Form DB side we have one parametrized SPs for each Business Object ...

Implementing MVC when using JPA

Hi! As I have understood MVC, the logic for the model should also go into model itself - making every object a selfcontained entity. This means that the methods of an class has to have triggers and chains of actions. For example, by using setZipCode(zip) in a Person class could trigger an action where it looks up the zip code from a zip...

With Eclipselink/JPA, can I have a Foreign Composite Key that shares a field with a Primary Composite Key?

My database has two entities; Company and Person. A Company can have many People, but a Person must have only one Company. The table structure looks as follows. COMPANY ---------- owner PK comp_id PK c_name PERSON ---------------- owner PK, FK1 personid PK comp_id FK1 p_fname p_sname It has occurred to me that I could remove PER...

Django RelatedManager's .create() usage?

I have two models: Play and PlayParticipant, defined (in part) as: class PlayParticipant(models.Model): player = models.ForeignKey('Player') play = models.ForeignKey('Play') note = models.CharField(max_length=100, blank=True) A piece of my code has a play p which has id 8581, and I'd like to add participants to it. I'm try...

Entity Framework and Oracle

I've got to look at the ORM solution for a new ASP.NET Web App with an Oracle backend. Has anyone had good/bad experience with using Entity Framework with Oracle? Are there any (free preferably) alternatives? ...

ORM and Database Constraints

How compatible is ORM and existing databases that have a lot of constraints (particularly unique key constraints/unique indexes beyond primary keys) enforced within the database itself? (Often these are preexisting databases, shared by numerous legacy applications. But good database modeling practice is to define as many constraints as ...

How to model an object with references to arbitrary number of arbitrary field types? (django orm)

I'd like to define a set of model/objects which allow for one to represent the relationship: field_set has many fields where fields are django.db.model field objects (IPAddressField, FilePathField etc). My goals is to have a ORM model which supports the following type of 'api'. From a controller view lets say: # Desired api below def...

ORM Tool - Crossroads?

Hi I seem to be at an ORM Tool crossroad and would like some advice of people who have faced a similar challenge. In the past I have been using CodeSmith with NetTiers Templates to generate my DAL all has been quite good, however I have decided to drop this for one reason or another. So I am at a crossroads and have found the following:...