[cf-orm-dev] ORM Error reporting

31 views
Skip to first unread message

Rupesh Kumar

unread,
Apr 29, 2010, 11:22:25 PM4/29/10
to cf-or...@googlegroups.com

Hi All,

I am looking into bug number 82409 which is asking for better error reporting in ORM. While I agree that there is room for improvement in this area and we have done a few already, I am looking for more specific pointers on this.

 

Could you please let us know those specific errors so that I can focus on them and get those fixed.

 

We have tried to report those errors that can be figured out with the CFC definition. The only area where we are kind of helpless is when the error is thrown by Hibernate.

 

Regards,

Rupesh

--
You received this message because you are subscribed to the Google Groups "cf-orm-dev" group.
To post to this group, send email to cf-or...@googlegroups.com.
To unsubscribe from this group, send email to cf-orm-dev+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cf-orm-dev?hl=en.

Rupesh

unread,
May 2, 2010, 11:49:22 AM5/2/10
to cf-orm-dev
Hi All,
We are still waiting to hear on this. Could you please take some time
out, think about it and let us know the specific issues before it is
too late?

Rupesh

unread,
May 6, 2010, 1:26:01 PM5/6/10
to cf-orm-dev
This is quite ironical. Seeing 17 votes on this bug, I was hoping to
get a huge amount of response to this but there is literally none.
Here is the last chance for you. If there is still no response by
tomorrow, I will assume that there is no real issue as such and will
close the bug.

- Rupesh

Barney Boisvert

unread,
May 6, 2010, 1:58:59 PM5/6/10
to cf-or...@googlegroups.com
The real problem is that Hibernate generates crappy error messages,
especially around mapping issues. If you guys are willing to roll
your own Hibernate (and can deal with the LGPL), a couple minor tweaks
to the error messages (to include entity/property names) would go a
long way in that regard. I haven't done it with CF9, but when I was
doing Hibernate dev a couple years ago we kept an internal vendor
branch for just this reason.

cheers,
barneyb
--
Barney Boisvert
bboi...@gmail.com
http://www.barneyb.com/

Sam Farmer

unread,
May 6, 2010, 3:15:40 PM5/6/10
to cf-or...@googlegroups.com
Rupesh,

I think what is causing frustration is that normally ColdFusion gives awesome error messages with the exact line, and sometimes character, where an error occurs.

ORM errors do not provide this.  For instance I just forced an error by doing this:

property name="answers" fieldtype="one-to-many"  cfc="Answer" fkcolumn="chargeID" inverse="false" type="struct" structkeycolumn="name,series";

 and what is returned is:

Error during DDL export

The error occurred in C:\web\Application.cfc: line 16
14 : 
15 : function onRequestStart() {
16 : 	ormReload();
17 : 

Which is significantly less information than we are used to.  Now, as Barney mentions, this may be all that you get from Hibernate then fair enough but it would be great to know which CFC and property declaration is causing this error.

With DDL errors I've also found that I can sometimes pull something out of the stack trace to help.  In the error I forced above it was:

Caused by: java.sql.SQLSyntaxErrorException: Syntax error: Encountered "," at line 1, column 35.

Which sometimes can help but not always.

HTH

Cheers,

Sam


Raymond Camden

unread,
May 6, 2010, 9:04:39 PM5/6/10
to cf-or...@googlegroups.com
Rupesh, I think that folks will all agree this is a problem - but if
we don't have the bugs right now it's hard to debug. I can tell you
that I'm responding to a person on email now who is getting "Error in
generating Hibernate configuration" when he runs ormReload. He has no
idea what's wrong.
--
===========================================================================
Raymond Camden, ColdFusion Jedi Master

Email : r...@camdenfamily.com
Blog : www.coldfusionjedi.com
AOL IM : cfjedimaster

Keep up to date with the community: http://www.coldfusionbloggers.org

Daniel

unread,
May 7, 2010, 3:31:04 AM5/7/10
to cf-orm-dev
I found it incredible painful to get an error like 'dll error' when
something went wrong during entity definitions. That's not what you're
used to by working with CF. More helpful error messages especially
during table creation would be a big help and time saver for people
new to hibernate.

Another useless message appears when try to delete entities with with
a foreignkey relationship.

Daniel

Rupesh Kumar

unread,
May 7, 2010, 4:52:38 AM5/7/10
to cf-or...@googlegroups.com
I completely agree with all of you. There are times when you get some error and it is difficult to find the reason from the error. The problem is - most of such errors are thrown by Hibernate and the error message does not provide enough information to be of much help. As Barney said, we cannot change Hibernate code to improve error messages because of licensing issues. In most of the cases, we cannot even throw any pre-emptive errors.

The only way to debug such issues would be to enable a detailed error logging by Hibernate. We will try to see how we can make this better.

However, we have done quite a few things to improve error reporting. Some of the important ones are
- If there is any CFC which has compilation errors, we will throw the error upfront. We were skipping those cfc earlier, which used to cause some other Hibernate error later in the application making it difficult to debug.
- In case the associated CFC (cfc in relation) is missing, we used to throw an error "Error in loading component XXX". This did not give any indication as in where this CFC is being used. We will now clearly say that in the error.
- During schema generation, if the 'drop' failed because of some reason, 'create' also fails but the error would just include 'create' errors. The error details would now include all the errors during schema generation if the 'create' fails. It would have been even more helpful if the SQL could be included along with the errors here but Hibernate does not provide that. The only way to debug that would be to enable DDL logging for errors.
- Error will be thrown if the sqlscript file specified does not exist
- Entityreload() will throw an exception if the object being passed is not a valid entity or if it is transient

What we are looking here is to collect all such errors so that we can improve the developer experience. If at all we cannot provide a fix for certain issues, at least we can document them or guide people so that they don't spend hours struggling with them.

Regards,

Raymond Camden

unread,
May 7, 2010, 9:36:13 AM5/7/10
to cf-or...@googlegroups.com
Rupesh, those first 2 fixes there are incredible (and in fact, going
to blog it to help spread the word). Thank you. (Or, if you blog, let
me know. Not everyone subscribes to this group.)


On Fri, May 7, 2010 at 3:52 AM, Rupesh Kumar <ruk...@adobe.com> wrote:
> I completely agree with all of you. There are times when you get some error and it is difficult to find the reason from the error. The problem is - most of such errors are thrown by Hibernate and the error message does not provide enough information to be of much help. As Barney said, we cannot change Hibernate code to improve error messages because of licensing issues. In most of the cases, we cannot even throw any pre-emptive errors.
>
> The only way to debug such issues would be to enable a detailed error logging by Hibernate. We will try to see how we can make this better.
>

Nando

unread,
May 7, 2010, 10:11:41 AM5/7/10
to cf-or...@googlegroups.com
Rupesh,

One thing I noticed is that when defining an Entity in CF, simple mistakes in your code, like forgetting a semicolon, can throw  misleading, obtuse Hibernate errors. As others have said, I'm used to CF throwing errors that I can interpret. The other thing that tended to throw these errors are relationship configuration mistakes. There are so many attributes that can be used, and it is unclear which go together and which don't. If you get wrong, the Hibernate error isn't indicative of what the problem is. 

One of the difficulties for me has been that the obtuse errors combined with somewhat sparse documentation that included only dumbed down examples left me almost completely in the dark. I found myself just guessing, as if I was trying to learn a new language without a reference. Next time I need to go back to defining entities, I will be in the same boat, having forgotten most of the quirks that I encountered and somehow solved through lots of guesswork. It's not a task that most developers will work at on a daily basis.

I fully realize that Hibernate integration is a significant challenge, and your comments help me to see the limitations you are working under. It's an awesome feature to have in the language. Whatever you can do to make it easier for us to get through the task of configuring entities and their relationships with less guesswork would be greatly appreciated.

Kind regards,

Nando
--
Nando M. Breiter
The CarbonZero Project
CP 234
6934 Bioggio
Switzerland

+41 91 606 6372

na...@carbonzero.ch
www.carbonzero.ch

Nando

unread,
May 7, 2010, 10:19:31 AM5/7/10
to cf-or...@googlegroups.com
Oh, one more thing. I don't know what time pressure you are under to close this bug, but I think we would need a focused  effort and some months time to collect these errors for you at a designated collection point. I can understand why you didn't get much feedback. I only work on coding entities once every several months. We would need more time to get you this information.

adam drew

unread,
May 7, 2010, 10:22:10 AM5/7/10
to cf-or...@googlegroups.com
Hey Rupesh,

What about those wierd FK Constraint errors during schema update? Some, details from hibernate show up in the stack trace but the error detail is blank (or vague i don't remember what it says exactly) regarding the component and constraint throwing the error.. I haven't personally created one of these errors recently but I remember they are tough to track down, most of the time I had to drop the tables i was trying to update.... Would there be any way to show the hibernate error details from the stack in the error detail message?

Regards,

Adam D.

Nando

unread,
May 7, 2010, 10:27:48 AM5/7/10
to cf-or...@googlegroups.com
I ran into those when moving the application from the development to production environment. I *think* I solved it by deleting the constraints on the database itself and letting hibernate recreate them. Dropping the tables wasn't a good option, as a significant amount of data had already been entered. 
--
Nando M. Breiter
The CarbonZero Project
CP 234
6934 Bioggio
Switzerland

+41 91 606 6372

na...@carbonzero.ch
www.carbonzero.ch

mark

unread,
May 7, 2010, 10:28:47 AM5/7/10
to cf-or...@googlegroups.com

Rupesh,

 

If you can’t change Hybernate’s error messages, maybe you could capture (when the developer has enabled robust error handling or hit some other hibernate specific setting in the admin) the request before it goes to hibernate and check it for syntax and or other types of errors and return a message stating “possible errors in your cform calls” with the possibly offending code?

 

Mark

Brian Kotek

unread,
May 7, 2010, 10:37:00 AM5/7/10
to cf-or...@googlegroups.com
I don't think that would work, since it really takes Hibernate actually trying to execute the code to determine that something is wrong, especially at the database level. I'd also be somewhat concerned about the overhead that some sort of CF-side "validation pre-processor" would add. Unfortunately, I think they're really limited to working with the exceptions that Hibernate throws and doing their best to make them more clear.

Sam Farmer

unread,
May 7, 2010, 1:12:10 PM5/7/10
to cf-or...@googlegroups.com
Thinking out loud a bit.  As a catch all what about if the debugging is on and ormReload() is called:
  • Temporarily saving the current .HBMXML file(s)
  • Running the new code
  • If they fail, and other errors can't be deduced, then compare the new and the old HBMXML files and based on differences giving a list of possible problem areas?
That would give a place to start.  Thoughts?

Cheers,

Sam

Rupesh

unread,
May 9, 2010, 3:08:06 PM5/9/10
to cf-orm-dev


On May 7, 12:31 pm, Daniel <daniel.sch...@gmail.com> wrote:
> I found it incredible painful to get an error like 'dll error' when
> something went wrong during entity definitions. That's not what you're
> used to by working with CF. More helpful error messages especially
> during table creation would be a big help and time saver for people
> new to hibernate.
>

the error message will now include all the SQL errors that were thrown
during schema creation. Unfortunately, we cant get the sql for table
creation. (I have logged a hibernate bug to get that fixed.) However
the error thrown during importing the sql script file will also
include the SQL that has the errors.

> Another useless message appears when try to delete entities with with
> a foreignkey relationship.
>

Can you send us an example for the same?

Rupesh

unread,
May 9, 2010, 3:30:47 PM5/9/10
to cf-orm-dev


On May 7, 7:11 pm, Nando <d.na...@gmail.com> wrote:
> Rupesh,
>
> One thing I noticed is that when defining an Entity in CF, simple mistakes
> in your code, like forgetting a semicolon, can throw  misleading, obtuse
> Hibernate errors.

Already fixed as I said in a previous mail.

> As others have said, I'm used to CF throwing errors that I
> can interpret. The other thing that tended to throw these errors are
> relationship configuration mistakes. There are so many attributes that can
> be used, and it is unclear which go together and which don't. If you get
> wrong, the Hibernate error isn't indicative of what the problem is.
>

We have tried to throw as much errors as possible upfront during
configuration. We might have missed a few. It would be great if you
can provide such cases to us.

> One of the difficulties for me has been that the obtuse errors combined with
> somewhat sparse documentation that included only dumbed down examples left
> me almost completely in the dark. I found myself just guessing, as if I was
> trying to learn a new language without a reference. Next time I need to go
> back to defining entities, I will be in the same boat, having forgotten most
> of the quirks that I encountered and somehow solved through lots of
> guesswork. It's not a task that most developers will work at on a daily
> basis.
>

We are trying to improve the documentation but it is not possible to
cover everything about Hibernate in ColdFusion documentation.
Hibernate in itself is huge and it is well documented. There is no
point in duplicating the same thing in our docs and that is why we
have given the links for hibernate reference in the doc where ever
possible.You can also refer to the Hibernate books. (IMO, everyone
using ORM should get a copy of "Java Persistence with Hibernate" or
"Hibernate in Action"). Apart from that, there are quite a few
resources available on the net including the blogs by Mark Mandel, Bob
Silverberg, Ray Camden, Brian Kotek, me and many more. And last but
not the least, this mailing group is the one of the most valuable
resource available for folks using CF-ORM. Having said that, we ARE
trying to make our documentation better.

Rupesh.

Rupesh

unread,
May 9, 2010, 3:32:59 PM5/9/10
to cf-orm-dev


On May 7, 7:19 pm, Nando <d.na...@gmail.com> wrote:
> Oh, one more thing. I don't know what time pressure you are under to close
> this bug, but I think we would need a focused  effort and some months time
> to collect these errors for you at a designated collection point. I can
> understand why you didn't get much feedback. I only work on
> coding entities once every several months. We would need more time to get
> you this information.
>

Sure.. Keep sending them in. We will collate all such issues and try
to get them fixed.

Rupesh

unread,
May 9, 2010, 3:35:49 PM5/9/10
to cf-orm-dev
Adam and Nando,
It would be great if you could send us one sample which we could use
to replicate it at our end.

Rupesh.

Nando

unread,
May 10, 2010, 2:37:05 AM5/10/10
to cf-or...@googlegroups.com
Rupesh,

Thank you for your efforts and your proactive stance. I'll make a point to post any hibernate errors that are difficult to decipher as they happen in my workflow. 

Kind regards,

Nando
--
Nando M. Breiter
The CarbonZero Project
CP 234
6934 Bioggio
Switzerland

+41 91 606 6372

na...@carbonzero.ch
www.carbonzero.ch

Brett

unread,
May 11, 2010, 9:15:50 PM5/11/10
to cf-orm-dev
Hi Rupesh,

Here is one I just saw:

Take your database server offline, and request an app with the ORM
turned on. An error is thrown without a message or detail. Of type
java.lang.NullPointerException

The console logs a better message: "Could not create a connection to
the database server. Attempted reconnect 3 times. Giving up" but it
would be better to see this in the error struct.

thanks!

.brett

Evagoras

unread,
May 12, 2010, 4:03:46 AM5/12/10
to cf-orm-dev
Hi Rupesh.

How about an expanded validation framework for ORM? Right now, you can
add validation arguments inside your CFPROPERTY, but there is no way
to get all the errors before trying a SET or a SAVE (think of a form
submitting user input). Each individual cfproperty throws an
exception, one at a time. You know the inner-workings of this better
than I do. It's not friendly at all as it stands right now.

3 methods come to mind which would be super cool:
- validate()
- getErrors
- hasErrors()

We have been using Hyrule (http://hyrule.riaforge.org/) by Dan Vega to
go around this shortcoming, and we really like it. It would be great
if something like this could be implemented in the next CF update.
From what I gather, Dan is duplicating Hibernate functionality, so his
method might be easier to implement behind the scenes, if HIbernate
already has support for this.

Mark Mandel

unread,
May 12, 2010, 4:40:31 AM5/12/10
to cf-or...@googlegroups.com

I believe you are referring to the hibernate validation framework. This actually comes as a separate framework to hibernate.

It has the functionality you are looking for, but it would be interesting to see how the engineers allow for extension through cfml.

Without being able to extend the validation framework, it's not very useful.

But it is a great feature request. Add it to the tracker, I'll vote for it.

Mark

Sent from my mobile device

On 12 May 2010 18:04, "Evagoras" <evag...@gmail.com> wrote:

Hi Rupesh.

How about an expanded validation framework for ORM? Right now, you can
add validation arguments inside your CFPROPERTY, but there is no way
to get all the errors before trying a SET or a SAVE (think of a form
submitting user input). Each individual cfproperty throws an
exception, one at a time. You know the inner-workings of this better
than I do. It's not friendly at all as it stands right now.

3 methods come to mind which would be super cool:
- validate()
- getErrors
- hasErrors()

We have been using Hyrule (http://hyrule.riaforge.org/) by Dan Vega to
go around this shortcoming, and we really like it. It would be great
if something like this could be implemented in the next CF update.
From what I gather, Dan is duplicating Hibernate functionality, so his
method might be easier to implement behind the scenes, if HIbernate
already has support for this.


--
You received this message because you are subscribed to the Google Groups "cf-orm-dev" group.

T...

Kevin Roche

unread,
May 12, 2010, 5:49:38 AM5/12/10
to cf-or...@googlegroups.com
On Wed, May 12, 2010 at 9:03 AM, Evagoras <evag...@gmail.com> wrote:
How about an expanded validation framework for ORM?

I would vote for that. It's really essential and part of my own scaffolding framework.

Kevin
 

Evagoras Charalambous

unread,
May 13, 2010, 4:45:43 AM5/13/10
to cf-orm-dev
@Kevin and Mark:

I submitted an enhancement request in the Bug Tracker yesterday,
however I still don't see it showing up in the list. I will keep
checking and as soon as they have it up, I will add the ID here.

Mark Mandel

unread,
May 13, 2010, 5:04:55 AM5/13/10
to cf-or...@googlegroups.com
It should be there straight away.

You sure it submitted?
--
E: mark....@gmail.com
T: http://www.twitter.com/neurotic
W: www.compoundtheory.com

Hands-on ColdFusion ORM Training
www.ColdFusionOrmTraining.com

Brett

unread,
May 13, 2010, 10:06:07 AM5/13/10
to cf-orm-dev
I've noticed if you mark a bug or enhancement for a not yet public
release it won't show in the bug list. I do get the "confirmed by
team" email so they go somewhere.

Evagoras Charalambous

unread,
May 17, 2010, 5:39:56 AM5/17/10
to cf-orm-dev
I finally got an email from Adobe regarding my submission (shown
below). Even though it has an ID, it's still not listed in the bug
tracker. I suppose Brett might be right, about enhancement requests
not showing up. Anyway, I hope they implement something like my
request, I am sure lots of people would find it useful.

-->
The bug entered on Wednesday, May 12, 2010 has been marked verified by
Adobe ColdFusion Team.

This means Adobe ColdFusion Team has verified the behavior you've
observed.

(If this email is addressed to you directly, you've logged this bug.
Otherwise, you've subscribed to this bug through the Adobe beta site
and are receiving a BCC.)

Targeted for: ColdFusion 10.0, Beta 1

Note: Any targeting information included above is an estimate.
Targeting can change during the course of bug triage.

Product Area: Language Enhancements
Severity: 8 - Not Applicable
Description: How about an expanded validation framework for ORM that
includes proper error handling and attribute validation at run-time?
Right now, you can add validation arguments inside your CFPROPERTY,
but there is no way to get all the errors before trying a SET or a
SAVE (think of a form submitting user input). Each individual
cfproperty throws an exception, one at a time as you try to SET() a
value in the object. This is not friendly at all and really unusable
as it is.3 methods come to mind which would be super cool for any ORM
object to inherit:- validate()- getErrors()- hasErrors()We have been
using Hyrule (http://hyrule.riaforge.org/) by Dan Vega to go around
this shortcoming, and we really like it. It would be great if
something like this could be implemented in the next CF update. From
what I gather, Dan is duplicating Hibernate functionality (from the
existing Validation framework), so his method might be easier to
implement behind the scenes, if Hibernate already has support for this.

Evagoras Charalambous

unread,
May 17, 2010, 5:41:47 AM5/17/10
to cf-orm-dev
Sorry, here's the ID too:
82847

:-)

Mark Mandel

unread,
May 17, 2010, 5:54:35 AM5/17/10
to cf-or...@googlegroups.com
Heh, it looks like Dan Vega and Bob Silverberg may soon be "Mandeled" in CF10 ;o)

Mark

Nando

unread,
May 20, 2010, 10:20:18 AM5/20/10
to cf-or...@googlegroups.com
Rupesh,

Here's one. I see an error that says:

******
Exception in

An association from the table Client_Contact refers to an unmapped class:

(org.hibernate.MappingException)

******

There is no indication in the error message what template or line is throwing the error.

The mapping certainly seems correct. Here are the class declarations:
Client.cfc
<cfcomponent output="false" persistent="true">
    <cfproperty
        name="clientId"
        type="numeric"
        fieldtype="id"
        datatype="integer"
        generator="identity" />
    <cfproperty name="shortName" type="string" length="20">
    <cfproperty name="name" type="string" length="50" />
    <cfproperty name="address1" type="string" length="50" />
    <cfproperty name="address2" type="string" length="50" />
    <cfproperty name="city" type="string" length="50" />
    <cfproperty name="zipcode" type="string" length="10" />
    <cfproperty name="country" type="string" length="20" />
    <cfproperty name="phone" type="string" length="50" />
    <cfproperty name="fax" type="string" length="50" />
    <cfproperty name="email" type="string" length="100" />
    <cfproperty name="website" type="string" length="200" />
    <cfproperty name="isActive" type="boolean" />
   
    <cfproperty name="contacts" hint="Array of contacts" singularname="contact"
          fieldtype="many-to-many" collectiontype="array" cfc="Contact"
          linktable="Client_Contact" fkcolumn="clientId" inversejoincolumn="contactId" orderby="firstName">
</cfcomponent>

Contact.cfc
component output="false" persistent="true"
{
    property name="contactId" type="numeric" fieldtype="id" datatype="integer" generator="identity";
    property name="firstName" type="string" length="50";
    property name="lastName" type="string" length="50";
    property name="function" type="string" length="50";
    property name="phone" type="string" length="50";
    property name="mobile" type="string" length="50";
    property name="fax" type="string" length="50";
    property name="email" type="string" length="100";
    property name="comment" sqltype="longtext";

}

I ran ormReload() several times and that didn't fix it. Then I touched Contact.cfc, effectively removing a comment, and now the error has disappeared (good) and I can't get it to return by reinserting the comment (puzzled). I am sure I reinserted the comment exactly as it was.

Sorry this is less useful than I wanted it to be in terms of providing a reproducible example.

Nando

--
Nando M. Breiter
The CarbonZero Project
CP 234
6934 Bioggio
Switzerland

+41 91 606 6372

na...@carbonzero.ch
www.carbonzero.ch

Sam Farmer

unread,
May 20, 2010, 10:24:53 AM5/20/10
to cf-or...@googlegroups.com
I had a very similar error and the problem came down to having multiple mappings to model folder.  What mappings do you have defined in the App.cfc?

As you are not using mappings in your definitions that might not be the case here but worth a shot!

Cheers,

Sam

Nando

unread,
May 21, 2010, 6:27:18 AM5/21/10
to cf-or...@googlegroups.com
Hi Sam,

I have

this.mappings["/root"] = getDirectoryFromPath(getCurrentTemplatePath());

and

    this.ormsettings = {
        cfclocation="./model",
        dbcreate="update",
        eventhandling="true",
        eventhandler="root.model.eventHandler",
        logsql="true",
        dialect = "MySQLwithInnoDB",
        flushatrequestend = false
    };

Nando

unread,
May 21, 2010, 6:31:43 AM5/21/10
to cf-or...@googlegroups.com
Oops, that email somehow got sent before I finished.

Like I was saying, I have


this.mappings["/root"] = getDirectoryFromPath(getCurrentTemplatePath());

and

    this.ormsettings = {
        cfclocation="./model",
        dbcreate="update",
        eventhandling="true",
        eventhandler="root.model.eventHandler",
        logsql="true",
        dialect = "MySQLwithInnoDB",
        flushatrequestend = false
    };

defined in Application.cfc, however the error somewhat mysteriously went away after touching Contact.cfc and I can't get it to return by adding the comment back in in exactly the same way.

Nando
Reply all
Reply to author
Forward
0 new messages