This is another work use-case example. We had a need to use some of the parent/child inheritance that ORM provides using a discriminator column (adobe's docs on using a subclass with discriminator).
The reasoning, is that there were specific types of children that had specific data attributes (it all revolved around a rule engine where the results had a shared set of data points, but depending on the rule type, the actual result data would change dramatically) and so, to avoid having a bunch of null values in the parent table, we were going to create the child tables appropriately.
Here's where it started to get tricky. We needed to map a relationship from the child object to a different table because, well because that relationship existed. Unfortunately, ORM didn't like that...
Showing posts with label Troubleshooting. Show all posts
Showing posts with label Troubleshooting. Show all posts
Wednesday, May 30, 2012
Sunday, May 27, 2012
Being aware of ORM sessions and gotchas
So recently at work I was trying to troubleshoot an odd issue I had never seen before. I was getting an odd error from a relatively simple HQL query:
Informative, right?
The query being ran was a simple fetch query along the lines of:
Basically, there was nothing to indicate that there was a numeric value that was being populated with a null string.
So where did the error come from?
Root cause :org.hibernate.HibernateException: coldfusion.runtime.Cast$NumberConversionException: The value '' cannot be converted to a number.
Informative, right?
The query being ran was a simple fetch query along the lines of:
hql = "FROM artists WHERE id = :id";
artist = ormExecuteQuery( hql, {id = 1}, true);
Basically, there was nothing to indicate that there was a numeric value that was being populated with a null string.
So where did the error come from?
Subscribe to:
Comments (Atom)