Status update:
I only need proper test cases for multiple databases, but I got a working
webapp that uses a number of different databases and on the surface it
appears to work. Hurray.
The setup of this webapp:
* package entities.one and entities.two, with a couple of entities in each
package
* marker annotations One, Two and Three
* configuration files hibernate-one.cfg.xml, hibernate-two.cfg.xml and
hibernate-three.cfg.xml
* module:
public static void contributeHibernateMarkerConfiguration(
Configuration<Class> configuration) {
configuration.add(One.class);
configuration.add(Two.class);
configuration.add(Three.class);
}
public static void contributeHibernateEntityPackageManagerThree(
Configuration<String> configuration
) {
configuration.add("nl.tvandijk.entities.one");
}
@Match("Test")
public static void adviseStuff(HibernateTransactionAdvisor advisor,
MethodAdviceReceiver receiver) {
advisor.addTransactionCommitAdvice(receiver);
}
* some pages with CommitAfter annotations
* a Test interface with implementation and CommitAfter annotations.
The interpretation of CommitAfter is as follows:
@CommitAfter ({One.class, Two.class}) = apply pattern for databases One,
Two.
@CommitAfter = apply pattern for unmarked database (if no markers
contributed)
= apply pattern to all databases (otherwise)
There is a restriction on the markers. The must be unique in
simplename-lowercase. The class.getSimpleName().toLowerCase() is used as an
identifier in several places, most importantly (on the top of my head) the
configuration-«identifier».cfg.xml and in the entity value encoder. Because
iirc Tapestry requires a URL to be case insensitive, I'm just using
equalsIgnoreCase and toLowerCase.
I asked Josh to pull from my git repo again for code review. You can also
pull from my git if you prefer that
(git://hetdiana.homeip.net/tapestry5.git branch hibmod2)
I "solved" the ServiceOverride question by only overriding the Session if
no markers are contributed. If markers are contributed to
HibernateMarkerConfiguration, no service overrides are contributed. (( I'm
still not sure if it wouldn't be a cleaner solution if the third party just
uses markers properly, but if I get this correct, the service override
means "default : use mine" instead of "default : generate error" whenever
no markers are used? ))
Idea: maybe a @Contribute(serviceInterface, markers) might be useful. As
well as probably dozens of other places where a serviceId is used right now
instead of a serviceInterface+markers reference.
Regards,
Tom.
On Sat, 23 Oct 2010 08:28:41 -0700, Howard Lewis Ship <[email protected]>
wrote:
> ServiceOverride is for the case where there are no marker annotation
> but there is an ambiguity which most often happens when overriding an
> existing service.
>
> On Sat, Oct 23, 2010 at 5:28 AM, Tom van Dijk <[email protected]> wrote:
>> Regarding this ServiceOverride, I am still not sure about the
semantics.
>>
>> How would I change this for multiple services? Is there perhaps another
>> way to solve TAPESTRY-2615?
>>
>> Regarding the rest of the changes: my git now contains an update which
>> implements nearly everything.
>> What I did not do yet:
>> - HibernateGridDatasource
>> - Statistics page
>> - Test cases for multiple databases
>>
>> Tom.
>>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]