By Peter Bell

Polymorphic Queries

One thing that is quite nice in Hibernate is the support for polymorphic queries. Let's say that I have a number of companies that I do business with - vendors and customers. They may be in different tables (lets say tbl_Vendor and tbl_Customer) if I implement a "one table per concrete class" inheritance strategy, but I can still query for all of the Companies that I do business with. If I'm using one table per concrete class, Hibernate uses a union of two queries plus the setting of null columns (to give vendors the customer columns and vice versa) to return the results of the query. Obviously if I'm using one table per class hierarchy, Hibernate can just run a simple query against the tbl_Company table to get the results.

Default Values

Continuing on from an earlier posting, I'm looking at the different meaning of "default values" within an application and some ways of distinguishing them . . .

[More]

Some More Persistence Patterns

Some other interesting ideas from Hibernate: serializable Value object classes, properties utilizing a SQL formula, generated property types, and default values . . .

[More]

Inheritance in Hibernate: Should an Object Ever Have More than one Type?

Let's say you have an inheritance hierarchy where Vendor and Customer are both subclasses of Company. So, you deal with companies that could be Vendors or Customers. The question is, what happens if a given Company is both a Vendor and a Customer? . . .

[More]

Object LifeCycles: Value Objects, Composed Objects and Associated Objects

When thinking about persistence, one of the concerns is the lifecycles of the objects you are persisting (necessary to understand how/when to implement cascading deletes) . . .

[More]

Entity vs Value Types in Hibernate

Hibernate is really the gold standard for ORM's, and if you have any interest in persisting object models it makes sense to study Hibernate - whether to use it or to learn from the patterns that they use.

One interesting pattern in Hibernate is the distinction between Entity and Value object types . . .

[More]

How Would You Solve the Order:Address Problem?

Let's say you're building a commerce system. An Order has a BillingAddress. You want to support address book functionality where users can re-use, edit and delete addresses, but once an order has been placed, you want to fix the BillingAddress for that order while still allowing it to be editable within the address book. What's the best way to solve the problem? . . .

[More]

What Should a Persistence Framework Do?

At its simplest, the goal of a persistence framework is to simplify and speed up the process of handling persistence of your applications. What a persistence framework needs to do depends heavily on your use cases. Here are the core problems I would personally like a persistence framework to solve . . .

[More]

Objects, Tables and ORMs – part deux

The other day I looked at inheritance strategies for ORMs. Today I want to look at some of the other times where there isn't necessarily a 1:1 relationship between objects and database tables . . .

[More]

Objects, Tables and ORMs

One of the quickest tests of an ORM is to look at how flexible it is when mapping objects to tables. Here are some of the possible requirements to consider . . .

[More]

More Entries

BlogCFC was created by Raymond Camden. This blog is running version 5.005.