> > I suggest that named query validation be done by the 
> > Dialect implementation, rather than by checking against a live DB.
> 
> Why the dialect?  It doesn't know about the schema, does it?  

Ok, I guess I wasn't being particularly precise when I suggested the Dialect.  The 
complete validation would be a combination of the current HQL compiler and the 
Dialect.  HQL is already validated against the schema defined in the mapping.  What 
this thread is all about is checking   that:

1)      All of the objects defined in the mapping actually exist in a given DB 
instance.
2)      Ensuring that the SQL produced by the HQL compiler is actually valid for a 
given DB.  

As mentioned elsewhere in this thread, 1 can be done via the (possibly extended) 
schema export tool.

Item 2 is what I would expect to be the job of the Dialect.  If a given Dialect 
implementation is told to produce a sub-select, it should only do so if the 
implemented SQL flavour actually supports that syntax.  I realise that much of this 
functionality is produced in common code, but I am suggesting that the best approach 
to this problem is to refactor the SQL generation code so that the Dialect has the 
ability to make these decisions.

> It seems that
> Hibernate (by design) uses the database itself to check the generated
> SQL versus the db schema in a 'late binding' manner.   Users
> (myself included) may expect this, so I would think that any
> query validation would need to be optional or elective at least.
> 

I agree.

> In any case, it is true that the database will always check
> the SQL it recieves for compatibility with the schema anyway, so
> maybe this query validation would simply provide better error
> messages?  If so, that sounds to me like a 'nice to have' rather 
> than a 'must have'. (remember: FNG here)
> 

I agree with that, too.

ADK
-----------------------------------------------------------------------------------------------
Have you seen our website?.... http://www.vodafone.co.nz

CAUTION: This correspondence is confidential and intended for the named recipient(s) 
only.
If you are not the named recipient and receive this correspondence in error, you must 
not copy,
distribute or take any action in reliance on it and you should delete it from your 
system and
notify the sender immediately.  Thank you.

Unless otherwise stated, any views or opinions expressed are solely those of the 
author and do
not represent those of Vodafone New Zealand Limited.

Vodafone New Zealand Limited
21 Pitt Street, Private Bag 92161, Auckland, 1020, New Zealand
Telephone + 64 9 357 5100
Facsimile + 64 9 377 0962


-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 -
digital self defense, top technical experts, no vendor pitches,
unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel

Reply via email to