orm

Mapping many-to-many without a join table in Hibernate/NHibernate

I have two tables: CalendarEntry Id Date ... Holiday Id Date ... In my CalendarEntry class, I have a property like this public ISet<Holiday> Holidays { ... } which I want to associate to the Holiday instances that occur on the same Date as the CalendarEntry. However, I can't come up with how to do this. I've tried ma...

how does spring allow for lazy-loading?

If you have a call in a Dao method like (pseudo code): return ..getHibernateTemplate( get by id ); Now say that entity has a lazy-loaded collection. Once you return from your Dao using the hibernateTemplate helper method, how come the session stays in scope and allows you to lazy-load a collection? Is the session initialized and comm...

Configuring ASP.NET MVC 2 with Spring.NET and FluentNHibernate

Hello, I'm trying to configure ASP.NET MVC 2 RC and Spring .NET 1.3 to use FluentNHibernate. I've managed to get FluentNHibernate running inside console application. At moment ASP.NET MVC 2 RC and Spring .NET are working fine for me, but I'm having trouble configuring FluentHibernate. Before asking this question I have Googled a lot...

Hibernate resolve foreign key lookup id by name

I'm in the process of writing a module for an application that bulk imports data. I'm using Hibernate version 3 for data access. I receive a flat table of data let's call it products for simplicity and assume this data layout: Name, category, sub-category foo, main1, sub11 The category and sub-category fields actually refer to the ...

rails has_many :through has_many :through

I'm wondering to what extent I can use associations in Rails. Take into consideration the following: class User < ActiveRecord::Base has_one :provider has_many :businesses, :through => :provider end class Provider < ActiveRecord::Base has_many :businesses has_many :bids, :through => :businesses belongs_to :user end ...

Practical design for table field referencing more many tables.

The challenge I am facing is trying to come up with a good model design for a common table. A table "notes" is to be referenced by different objects. One way, I thought is to define 2 fields object type, object Id to record the type and the object the note belongs to. Then I am not sure this is the best practice. When it comes to generat...

How do I deal with business-object collection having millions of records in database ?

Here's the scenario. I have an application. Underlying database tables have millions of rows. Say table 'Books' has millions of rows. In the Application design, I have a custom business object Book and custom-collection BookCollection, to represent collection of books. We have written a tiny-ORM which is responsible for mapping between...

findByExample in Doctrine

Hi, Is there a method in doctrine like hibernate findByExample method? thanks ...

Naming of types when using an ORM

I am working on a project where a number of types have the suffix "Instance". For example, we have the concept of tabs in the application, so we have a TabInstance type. To me this seems redundant and even confusing / wrong, as there is already the concept of an instance in OO terminology. The system uses nHibernate as an ORM - I wond...

PHP Doctrine 1.2 table names

I'm trying to upgrade my doctrine ORM from 1.1.6 to 1.2.1 but i've enountered a BC issue with table names. Some of my table names have several words (e.g. t_foo_bar for class FooBar) where the t_ prefix is generated automatically with: $manager->setAttribute(Doctrine_Core::ATTR_TBLNAME_FORMAT, 't_%s'); This worked well in previous ve...

Fluent Nhibernate How to specify Id() in SubclassMap

Hello, I'm in the process of adapting Fluent NHibernate to our existing legacy app and am trying to determine how to use ClassMap and SubclassMap for the entity hierarchy shown. // BaseObject contains database columns common to every table public class BaseObject { // does NOT contain database id column public string CommonDbCol...

Another Spring + Hibernate + JPA question

I'm still struggling with changing my Spring Application to use Hibernate with JPA to do database activities. Well apparently from a previous post I need an persistence.xml file. However do I need to make changes to my current DAO class? public class JdbcProductDao extends Dao implements ProductDao { /** Logger for this class and s...

PHP ORMs: Doctrine vs. Propel

Hi, I'm starting a new project with symfony which is readily integrated with Doctrine and Propel, but I of course need to make a choice.... I was wondering if more experienced people out there have general pros and/or cons for going with either of these two? Thanks a lot. EDIT: Thanks for the all the responses, useful stuff. There's n...

Object properties for an indeterminate number of levels

This question is similar to this one but (literally) takes it to another level, or levels. Background: I am using the Kohana PHP framework and, specifically, the ORM library. Basically, when you loop through DB results with it, you can access the field values as properties of an object. Any joined tables can be accessed in a hierarchic...

Efficient representation of Hierarchies in Hibernate.

I'm having some trouble representing an object hierarchy in Hibernate. I've searched around, and haven't managed to find any examples doing this or similar - you have my apologies if this is a common question. I have two types which I'd like to persist using Hibernate: Groups and Items. * Groups are identified uniquely by a combination...

Propel Single Table Inheritance Issue

I have a table called "talk", which is defined as abstract in my schema.xml file. It generates 4 objects (1 per classkey): Comment, Rating, Review, Checkin It also generates TalkPeer, but I couldn't get it to generate the other 4 peers (CommentPeer, RatingPeer, ReviewPeer, CheckinPeer), so I created them by hand, and made them inherit ...

Mongomapper query collection problem

When I define the User has_many meetings, it automatically creates a "user_id" key/value pair to relate to the User collections. Except I can't run any mongo_mapper finds using this value, without it returning nil or []. Meeting.first(:user_id => "1234") Meeting.all(:user_id => "1234") Meeting.find(:user_id => "1234") All return nil....

seperate read and write databases with hibernate

With hibernate, I want to be able to support multiple databases, one for read and one for writes. Is this possible? Is the only way to create 2 separate session objects? ...

How to map both ManyToOne relationship and Join column as writable attributes in Hibernate?

Im working with a legacy database and an application written for Apple WebObjects and migrating that to Hibernate. I'm trying to map a many to one relationship and also its join attribute. But Hibernate gives "Repeated column in mapping" error if i try to do that, unless i make one of it readonly. But the application written in WebOb...

SwarmCache Hibernate configuration

Could anyone hint me how to configure SwarmCache for Hibernate to work in cluster (distributed cache)? Probably there are some other alternatives (please, don't suggest JBoss Cache)? ...