|
From: Tim K. <tim...@gm...> - 2006-03-17 19:47:33
|
Dmitriy,
Thanks for writing in with the suggestion. I will certainly give this a
try.
I still think, however, that it would be useful if the stock LSFB methods
would at least return some type of output regarding the operations that
occurred inside, or at least throw DAE.. since the javadocs are misleading
in that sense when they suggest that DAE will be thrown upon script
compilation errors. That's my view, at least.
Thanks again,
-tim
-----Original Message-----
From: spr...@li...
[mailto:spr...@li...] On Behalf Of
Dmitriy Kopylenko
Sent: Friday, March 17, 2006 1:52 PM
To: spr...@li...
Subject: Re: [Springframework-developer] somewhat confusing behavior w/ LSFB
create/update/dropSchema methods.
Dmitriy Kopylenko wrote:
>>
>> So it would seem that my only option is to subclass LSFB and modify
>> the behavior of those to collect the error messages and pass them on
>> up. I would think, however that those methods could benefit from
>> clearer javadoc comments on what I've just covered, and it would be
>> nice to be able to obtain that output (or to at least know somehow) to
>> be able to determine if any errors were generated, and have some sort
>> of output on the reasons why, since there is no way to accomplish that
>> right now without subclassing the LSFB itself (as far as I can see) -
>> and I'm somewhat leery of having to maintain a subclass of LSFB for
>> the entire foreseeable future of the application since it is such a
>> critical part of the spring/hibernate functionality. If I'm mistaken
>> on this, I'd greatly appreciate a point in the right direction.
>>
>
> If you call *DatabaseSchema() methods directly on LSFB instance, I
> think there could be more modular, cleaner, etc. solution than
> extending LSFB, by using AspectJ with Inter-Type declaration and
> "handler" pointcut designator...
>
>
Here's how you could possibly do it:
public aspect DatabaseShemaOperationsErrorsCollector {
private List<SQLException> LocalSessionFactoryBean.exceptions = new
ArrayList<SQLException>();
public List<SQLException>
LocalSessionFactoryBean.getDatabaseShemaErrors() {
return this.exceptions;
}
private void
LocalSessionFactoryBean.recordDatabaseSchemaException(SQLException
sqlException) {
this.exceptions.add(sqlException);
}
public pointcut databaseSchemaOperationExceptionHandler(SQLException
sqlException, LocalSessionFactoryBean localSessionFactoryBean):
handler(SQLException) &&
args(sqlException) &&
this(localSessionFactoryBean);
before(SQLException sqlException, LocalSessionFactoryBean
localSessionFactoryBean) :
databaseSchemaOperationExceptionHandler(sqlException,
localSessionFactoryBean) {
localSessionFactoryBean.recordDatabaseSchemaException(sqlException);
}
}
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Springframework-developer mailing list
Spr...@li...
https://lists.sourceforge.net/lists/listinfo/springframework-developer
|