database

Railo And AOP Transactions

If you're reading this, chances are good you're a software developer.  And that means you never touch the DB outside a transaction, right?  Of course, right.
Most of the time, transactions are a bit of a bear because their use is orthagonal to your business tasks.  To put that another way, business operations flow vertically from [...]

Embrace Your [HS]QL

I'd like to start with a confession.  I love SQL (and it's Hibernate counterpart HQL).  Its simplicity and elegance is remarkable.  Its expressive power is stunning.  It is almost universally disliked by developers.  Why is that?
The answer, at least to me, is pretty straightforward.  Developers spend a lot of their time programming, so that's where [...]

Domain Model Integrity

Unlike my last several posts, this one isn't ORM related.  At least not directly.  If you're using ORM, you necessarily care about your domain model's integrity, as it's a prerequisite for ORM doing it's job, but it has nothing to do with ORM specifically.  The point of a domain model is to be a representation [...]

Don't Forget Inverse="true"!

When you're mapping relationships with Hibernate, you have to reconcile the uni-directional nature of Java references with the bi-directional nature of RDBMS foreign keys.  Consider this simple database schema with a single relationship:
+———-+
+——–+    | PET     |
+ PERSON |    +———-+
+——–+    | [...]

Why ORM Transactions are Crucial

Continuing the transactions thread, I wanted to talk about a couple specific reasons that transactions are vitally important in ORM applications.  Even more than in raw-SQL applications.  I consider them mandatory anywhere, but I would argue that if you feel compelled to skip them for some reason, you'd be better off leaving them out of [...]

Transaction Demarcation

Transaction Demarcation

Transactions are important, and I wanted to talk about them a little, particularly as they relate to ORM.  If you're on the cf-orm-dev mailing list you've undoubtedly seen this topic come up over and over again.  And probably started muting conversations when my name shows up.  But before digging into the details, we need to [...]

Tag-Based HQL Queries on CF9

I'm sure I wasn't the only one that was sorely disappointed when Adobe released CF9 without the ability to execute HQL queries via the CFQUERY tag.  Using a function (ormExecuteQuery) works, but it's really ungainly if you have complex – or even just long – HQL or need to build your statement conditionally, and you [...]

MySQL Tuning

While tuning my new server, I came across an article on  MySQL tuning that does a really great job of laying out the main options that need to be tweaked, as well as explaining what they do.  It's several years old, but still applicable.  Also worth mentioning that MySQL ships with four "sample" configuration files [...]

Holding Out for a [MySQL] Hero

I've been fighting this god-forsaken query for a week, and can come up with absolutely no explaination for its behaviour.  Next time I see you, I'll buy you a beer if you can help me understand what's going on.  There are two tables involved, and here are their CREATE statements:
CREATE TABLE `sequence` ( — contains [...]

Watch Your Column Types

I've been bit by this twice in the past few months: comparing database columns that aren't the same type is really really expensive.  If you've only got a few rows, no big deal, but if you've got a few hundred thousand (or a few tens of millions) it makes a huge difference.  And varchar is [...]