orm

How would you model a "default child" flag with an ORM?

Hi everyone! I'm using an ORM (SQLAlchemy, but my question is quite implementation-agnostic) to model a many-to-many relationship between a parent class and its children.. I was wondering, what would be a simple way to express the concept "one of the children is the default/main one"? For example, I'd need to persist the following: Th...

How do you avoid the n+1 problem with SubSonic?

Ayende has a blog post detailing how to combat the "n+1" problem in nHibernate. In essence, the problem is this: Assume you have two tables, "BlogPosts" and "Comments" with a one-to-many relationship between them (i.e. each BlogPost can have multiple Comments). Now, let's say you want to execute the following nested for loop: foreach...

Using FreeText with SubSonic

Is there a general consensus on how to use SQL 2005's full text search with SubSonic? I know that I can use the InlineQuery and get an IDataReader, but is this the only way to do this? Also, how would I incorporate paging into it? Would I have to write the paging myself in the InlineQuery? What I would really like to do is something ...

Correct Model Data Structure? (My 1st Rails App)

I'm about to build my first Ruby on Rails application (and first anything beyond xhtml and css), and I'm looking for some helpful feedback on my model structure. I've included a mockup to help visual the application. The only models I'm sure I need so far are: 1. a movie model (to serve as the main model, named movie so URL's will look...

Can linq2sql do this without a lot of custom code?

Just dipping my toes into Linq2sql project after years of rolling my own SQL Server DB access routines. Before I spend too much time figuring out how to make linq2sql behave like my custom code used to, I want to check to make sure that it isn't already "built" in behavior that I can just use by setting up the relationships right in the...

Compare and Contrast NHibernate and OpenAccess from Telerik

Have you used the OpenAccess ORM from Telerik? How does it compare to NHibernate? When should I consider using it over NHibernate? ...

How to add additional information to a many-to-many relation?

I'm writing a program to manage orders and then print them. An order is an object containing the ordering person, the date and the products this person orders. I'd like to add the amount of a certain product one orderer. E.g. 3 eggs, 2 breads. Is there a simpler way doing this with storm (the ORM I'm using) than splitting the order int...

O/R mapping tools ASP

Are there O/R mapping tools for ASP (not ASP.NET) and are these useful in ASP? Lieven Cardoen ...

Hibernate generates invalid SQL query with MySQL

I have the following JPA entity classes (example case). A House belongs on a single Street. A Street has many Houses. @Entity public class House { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) public Integer id; public String name @ManyToOne public Street street; } @Entity public class Street { ...

How to keep code base and database schema in synch?

So recently on a project I'm working on, we've been struggling to keep a solution's code base and the associated database schema in synch (Database = SQL Server 2008). Database changes occur fairly regularly (adding columns, constraints, relationships, etc) and as a result it's not uncommon for people to do a 'Get Latest' from source ...

Batch inserts with JPA/EJB3

Does JPA/EJB3 framework provide standard way to do batch insert operation...? We use hibernate for persistence framework, So I can fall back to Hibernate Session and use combination session.save()/session.flush() achieve batch insert. But would like to know if EJB3 have a support for this... ...

Why should you use an ORM?

If you were to motivate the "pros" of why you would use an ORM to management/client, what would the reasons be? Try and keep one reason per answer so that we can see what gets voted up as the best reasons ...

Experiences With Active Objects ORM for Java?

I'm looking at ORMs for Java and Active Objects caught my eye. Apparently, it was inspired by Rails' ActiveRecord. Based on what I've read, this approach seems to solve a lot of problems with existing Java ORMs by embracing convention over configuration. What's been your experience with it? ...

ORM performance cost

Does anyone have any experience that indicates what kind of performance hit a developer could expect by choosing to use an ORM (in Django, RoR, SQLAlechemy, etc) over SQL and hand-designed databases? I imagine there are complicating issues, including whether specifying a database within the constraints of an ORM increases or decreases th...

What Java ORM do you prefer, and why?

It's a pretty open ended question. I'll be starting out a new project and am looking at different ORMs to integrate with database access. Do you have any favorites? Are there any you would advise staying clear of? ...

Would you use NHibernate for a project with a legacy database, which is partly out of your control?

For me the answer is currently: No, I would use iBatis, because NHibernate is a pain, when the database model and the object model are not in synch. If I don't have full control over the database I end up with a lot of work. Why do I ask? Well, first of all: I never used NHibernate. I just know it from the surface. I have read about th...

Unique fields that allow nulls in Django

I have model Foo which has field bar. The bar field should be unque, but allow nulls in it, meaning I want to allow more than one record if bar field is null, but if it is not null the values must be unque. Here is my model: class Foo(models.Model): name = models.CharField(max_length=40) bar = models.CharField(max_length=40, un...

Does Django development provide a truly flexible 3 layer architecture?

A few weeks ago I asked the question "Is a PHP, Python, PostgreSQL design suitable for a non-web business application?" http://stackoverflow.com/questions/439759/is-a-php-python-postgresql-design-suitable-for-a-business-application A lot of the answers recommended skipping the PHP piece and using Django to build the application. As I've...

NHibernate Insert is Committing but object is not persisted in table.

When debugging everything appears good. The insert commits and there is no roll back, no exceptions. I sure hope some can help with this. Here is my call: using (ITransaction transaction = _session.BeginTransaction()) { _session.Save(calc); transaction.Commit(); } Real simple mapping: <hibernate...

Zend_Db_Table Relationships and Zend_Paginator

Hi, is there a way, hot to apply paginator limit on select, which I send to findDependentRowset function? for example: $select = $row->select(); $select->order('item_name'); $row->findDependentRowset($table, null, $select) thank's ...