|
From: Colin S. <col...@ex...> - 2005-03-12 18:54:04
|
TxAttribute was intentional. The problem with TransactionAttribute is
that that is what EJB3 uses. If we use that, then it would preclude a
file having both our and their Annotations, or they would have to be
spelled out in fully qualified form (with package). I think that's not
acceptable.
However, I just saw an AOP/Annotations article a few days ago (from
Adrian Coyler I think), where he made up an annotation called
'Transactional'. How about using that?
Colin
Thomas Risberg wrote:
> +1 for TransactionAttribute
>
> I also think that an add-on download would be OK to begin with, but
> we need to come up with a long-term strategy for targeting 1.3, 1.4
> and 5.0.
>
> Thomas
>
> On Mar 12, 2005, at 11:43 AM, Juergen Hoeller wrote:
>
>> I've just looked at the code in the "tiger" module. I haven't
>> considered
>> that annotation classes *themselves* use annotations too. This
>> indeeds needs
>> to be built with "-source 1.5" and consequently also with "-target
>> 1.5".
>>
>> Which means that it's not feasible to include this in the standard
>> Spring
>> 1.2 download. I guess it's best then to keep the standard download
>> buildable
>> on JDK 1.4, an of course runnable on JDK >= 1.3.
>>
>> There is also a couple of things worth considering from the
>> implementation
>> point of view. The JDK 1.5 enums for propagation behavior and isolation
>> level are pretty generic and would make sense in the transaction
>> package
>> itself in a full JDK 1.5 version of Spring, replacing
>> PlatformTransactionManager's constants completely.
>>
>> Furthermore, I would prefer "TransactionAttribute" or
>> "TransactionAnnotation" instead of "TxAttribute": we don't use "tx"
>> anywhere
>> else. I think this has already been discussed before, but I don't
>> remember
>> the result. Sure, we already have a TransactionAttribute class in the
>> "transaction.interceptor" package, but that wouldn't hurt if the JDK
>> 1.5
>> stuff is in a separate package.
>>
>> I would suggest to do a preview/add-on download of the JDK 1.5
>> transaction
>> annotation support plus the corresponding JPetStore version,
>> probably around
>> the time of Spring 1.2 final (alongside the Web Flow preview
>> download). No
>> problem to build with JDK 1.5 there!
>>
>> -----
>>
>> I'll also keep the Hibernate3 annotation support out of Spring 1.2.
>> After
>> all, Hibernate annotations are still alpha anyway. The
>> AnnotationSessionFactoryBean is pretty simple anyway, so it should be
>> sufficient to put this integration code on the Wiki or the like.
>> Essentially, if you stick to enumerating the names of annotated
>> classes in
>> standard "hibernate.cfg.xml", all you need is:
>>
>> public class AnnotationsSessionFactoryBean extends
>> LocalSessionFactoryBean {
>>
>> protected Configuration newConfiguration() throws
>> HibernateException {
>> return new AnnotationConfiguration();
>> }
>> }
>>
>> and hibernate-annotation.jar on the class path. Actually, I'll
>> probably add
>> a "configurationClass" property to our default
>> LocalSessionFactoryBean: then
>> you wouldn't even need such a subclass but only a
>> LocalSessionFactoryBean
>> definition with:
>>
>> <bean id="sessionFactory"
>> class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
>> <property name="configLocation">
>> <value>classpath:hibernate.cfg.xml</value>
>> </property>
>> <property name="configurationClass">
>> <value>org.hibernate.cfg.AnnotationConfiguration</value>
>> </property>
>> </bean>
>>
>> That should be good enough for a start. Enumerating the names of
>> annotated
>> packages and classes on the LocalSessionFactoryBean itself is a
>> convenience
>> feature that we can arguably provide later; it's easy enough to do in a
>> custom subclass of LocalSessionFactoryBean.
>>
>> Juergen
>>
>>
>>
>> -----Original Message-----
>> From: spr...@li...
>> [mailto:spr...@li...]On Behalf
>> Of Colin Sampaleanu
>> Sent: Friday, March 11, 2005 11:42 PM
>> To: spr...@li...
>> Subject: Re: [Springframework-developer] Hibernate 3 annotations in 1.2
>> rc1
>>
>>
>> Parallel to the 'spring' module is a module called samples. Inside
>> that is a
>> tiger
>> project which contains the transaction Annotations stuff, including a
>> unit test, as well as some more experimental JMX Annotation stuff that
>> Rob did. Also inside samples is a
>> tiger-samples/jpetstore-annotations
>> project which is a version of the JPetstore that is almost identical to
>> the commons-attribute version of the petstore, except it uses the
>> Annotations code. The latter depends on the code from the 'tiger'
>> project.
>>
>> The ant builds and Eclipse projects for these both use and expect JDK
>> 1.5. There's no IDEA projects, since I don't use IDEA.
>>
>> Colin
>>
>> Juergen Hoeller wrote:
>>
>>> Well, we could simply give this a try - we'll see whether defining
>>> annotation classes and writing annotations access works with
>>> "-target 1.3".
>>> Generics shouldn't be a problem when just accessing an API - that
>>> should
>>> (hopefully) not require "-target 1.5". Anyway, let's give this a try!
>>>
>>> On this occasion: Where does the JDK 1.5 transaction annotation code
>>
>> reside?
>>
>>> I can't find it in Spring CVS yet... We need to proceed quickly
>>> here; after
>>> all, 1.2 RC1 is less than a week a way.
>>>
>>> Juergen
>>>
>>>
>>> -----Original Message-----
>>> From: spr...@li...
>>> [mailto:spr...@li...]On
>>> Behalf
>>> Of Colin Sampaleanu
>>> Sent: Friday, March 11, 2005 10:34 PM
>>> To: spr...@li...
>>> Subject: Re: [Springframework-developer] Hibernate 3 annotations in
>>> 1.2
>>> rc1
>>>
>>>
>>> We we do need to include the actual Annotation source files
>>> somewhere...
>>>
>>> On top of that, yes, you access the actual annotations via calls like
>>> Annotation ann = targetClass.getAnnotation(filter);
>>> or
>>> Annotation ann = targetMethod.getAnnotation(filter);
>>>
>>> Now Annotation itself is for the most part just a regular
>>> Interface, but
>>> it does have a method in it
>>> Class<? extends Annotation> annotationType();
>>> which is 1.5 syntax specific, so I personally think 1.3 code is
>>> going to
>>> barf on trying to use this interface, never mind that in practice, any
>>> code which gets the annotation will quickly try to see if it's a
>>> specific type (subclass) of Annotation (since this is just a marker
>>> interface that does nothing by itself), and do something with it, so
>>> really the code that manipulates the Annotations themselves would have
>>> to be compiled as 1.5 as well.
>>>
>>> Colin
>>>
>>> Juergen Hoeller wrote:
>>>
>>>
>>>
>>>> Well, we only want to *access* annotations through the
>>>> corresponding JDK
>>>>
>>>>
>>> 1.5
>>>
>>>
>>>> API. That should be possible with -source 1.3 and -target 1.3 too,
>>>> if I
>>>> understand the issue correctly.
>>>>
>>>> The only thing we can't do is include annotations in our sources and
>>>
>> expect
>>
>>>> them to be compiled into the class files. Please let me know if I'm
>>>> completely mistaken :-)
>>>>
>>>> Juergen
>>>>
>>>>
>>>> -----Original Message-----
>>>> From: spr...@li...
>>>> [mailto:spr...@li...]On
>>>> Behalf
>>>> Of Colin Sampaleanu
>>>> Sent: Friday, March 11, 2005 10:01 PM
>>>> To: spr...@li...
>>>> Subject: Re: [Springframework-developer] Hibernate 3 annotations
>>>> in 1.2
>>>> rc1
>>>>
>>>>
>>>> I think JDK 1.5 generating 1.3 compatible code would hopefully work
>>>> fine. But realistically, we _do_ want to use annotations, as in the
>>>> current Tx Annotations code... So there the problem becomes that if
>>>> everything is in the same codebase, you can't really compile some
>>>> parts
>>>> with -1.3, and some with -1.5.
>>>>
>>>> Juergen Hoeller wrote:
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>> Well, as long as we just compile against JDK 1.5 API or jars
>>>>> built with
>>>>>
>>>>>
>>> JDK
>>>
>>>
>>>>> 1.5 (like hibernate-annotations.jar), we should be able to build
>>>>> with -target 1.3 on JDK 1.5. Thinks just become hard if we intend to
>>>>>
>>>>>
>>>>>
>>>>>
>>>> include
>>>>
>>>>
>>>>
>>>>
>>>>> annotations in some of our files or use generics.
>>>>>
>>>>> Admittedly, I haven't played with JDK 1.5 generating
>>>>> 1.3-compatible class
>>>>> files yet...
>>>>>
>>>>> Juergen
>>>>>
>>>>>
>>>>> -----Original Message-----
>>>>> From: spr...@li...
>>>>> [mailto:spr...@li...]On
>>>>> Behalf
>>>>> Of Colin Sampaleanu
>>>>> Sent: Friday, March 11, 2005 12:51 AM
>>>>> To: spr...@li...
>>>>> Subject: Re: [Springframework-developer] Hibernate 3 annotations
>>>>> in 1.2
>>>>> rc1
>>>>>
>>>>>
>>>>> Short of switching to separate source modules (hint hint :-) ),
>>>>> that's
>>>>> going to be pretty hard to do. We can compile with JDK 1.5, for
>>>>> lower
>>>>> target versions, but then if you don't specify a 1.5 target
>>>>> version, the
>>>>> annotations stuff would blow up.
>>>>>
>>>>>
>>>>> Juergen Hoeller wrote:
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>> Thanks for the suggestion, Dan! I've prototypically added such an
>>>>>> AnnotationsSessionFactoryBean.
>>>>>> However, the Hibernate3 annotations jar is built with JDK 1.5,
>>>>>> so we
>>>>>> can only build and ship this class if our build process switches to
>>>>>> JDK 1.5 required too. We might switch to building with JDK 1.5
>>>>>> anyway,
>>>>>> though, for our new transaction annotation feature that we'd
>>>>>> like to
>>>>>> ship in Spring 1.2.
>>>>>> Juergen
>>>>>>
>>>>>> -----Original Message-----
>>>>>> *From:* spr...@li...
>>>>>> [mailto:spr...@li...]*On
>>>>>> Behalf Of *Washusen, Dan
>>>>>> *Sent:* Thursday, March 10, 2005 7:09 AM
>>>>>> *To:* spr...@li...
>>>>>> *Subject:* RE: [Springframework-developer] Hibernate 3 annotations
>>>>>> in 1.2 rc1
>>>>>>
>>>>>> Incase anyone is interested; I’ve attached an implementation of
>>>>>> the bean definition I described below.
>>>>>>
>>>>>> Cheers,
>>>>>>
>>>>>> Dan
>>>>>>
>>>>>>
>>>>>> -------------------------------------------------------------------
>>>>>> ---
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>> --
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>> *From:* spr...@li...
>>>>>> [mailto:spr...@li...] *On
>>>>>> Behalf Of *Washusen, Dan
>>>>>> *Sent:* Wednesday, 9 March 2005 12:29 PM
>>>>>> *To:* spr...@li...
>>>>>> *Subject:* [Springframework-developer] Hibernate 3 annotations in
>>>>>> 1.2 rc1
>>>>>>
>>>>>> Hey guys,
>>>>>>
>>>>>> I’ve bean mucking around with Hibernate 3 (with annotations)
>>>>>> support in nightly build. All is going well but I thought I would
>>>>>> offer some feedback…
>>>>>>
>>>>>> 1. I had to extend the
>>>>>> org.springframework.orm.hibernate3.LocalSessionFactoryBean
>>>>>> class and override the newConfiguration() method to return
>>>>>> an instance of org.hibernate.cfg.AnnotationConfiguration.
>>>>>> 2. I then moved the list of mappings (from hibernate2)
>>>>>> specified by mappingResources into the hibernate.cfg.xml
>>>>>> file (using the format specified by the Hibernate
>>>>>> annotations page) and specified the location using the
>>>>>> configLocation property.
>>>>>>
>>>>>> Pretty easy really…
>>>>>>
>>>>>> A provided extension of LocalSessionFactoryBean that had support
>>>>>> for annotated classes would be nice. The bean definition could
>>>>>> look something like:
>>>>>>
>>>>>> <bean id="sessionFactory"
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>> class="org.springframework.orm.hibernate3.AnnotationsLocalSessionFac
>>>>> toryB
>>>>
>> e
>>
>>>>>
>>>>>
>>> a
>>>
>>>
>>>>>
>>>>>
>>>> n
>>>>
>>>>
>>>>
>>>>
>>>>> ">
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>> <property name="dataSource">
>>>>>>
>>>>>> <ref local="dataSource"/>
>>>>>>
>>>>>> </property>
>>>>>>
>>>>>> <property name="mappingPackage">
>>>>>>
>>>>>> <value>some.package</value>
>>>>>>
>>>>>> </property>
>>>>>>
>>>>>> <property name="annotatedClasses">
>>>>>>
>>>>>> <list>
>>>>>>
>>>>>> <value>com.package.Foo</value>
>>>>>>
>>>>>> <value>com.package.Bar</value>
>>>>>>
>>>>>> </list>
>>>>>>
>>>>>> </property>
>>>>>>
>>>>>> </bean>
>>>>>>
>>>>>> Cheers,
>>>>>>
>>>>>> Dan
>>>>>>
>>>>>> www.sensis.com.au
>>>>>>
>>>>>> A leading Australian advertising, information
>>>>>>
>>>>>> and directories business.
>>>>>>
>>>>>>
>>>>>> www.yellowpages.com.au
>>>>>> www.whitepages.com.au
>>>>>> www.citysearch.com.au
>>>>>> www.whereis.com.au
>>>>>> www.telstra.com.au
>>>>>> www.tradingpost.com.au
>>>>>>
>>>>>> This email and any attachments are intended only for the use of the
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>> recipient and may be confidential and/or legally privileged.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>> Sensis Pty Ltd disclaims liability for any errors, omissions,
>>>>>> viruses,
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>> loss
>>>>
>>>>
>>>>
>>>>
>>>>>>
>>>>>>
>>>>> and/or damage arising from using, opening or transmitting this
>>>>> email.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>> If you are not the intended recipient you must not use,
>>>>>> interfere with,
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>> disclose, copy or retain this email and you should notify the sender
>>>>> immediately by return email or by contacting Sensis Pty Ltd by
>>>>> telephone
>>>>>
>>>>>
>>> on
>>>
>>>
>>>>> [+61 3 8653 5000]
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>> www.sensis.com.au
>>>>>>
>>>>>> A leading Australian advertising, information
>>>>>>
>>>>>> and directories business.
>>>>>>
>>>>>>
>>>>>> www.yellowpages.com.au
>>>>>> www.whitepages.com.au
>>>>>> www.citysearch.com.au
>>>>>> www.whereis.com.au
>>>>>> www.telstra.com.au
>>>>>> www.tradingpost.com.au
>>>>>>
>>>>>> This email and any attachments are intended only for the use of the
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>> recipient and may be confidential and/or legally privileged.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>> Sensis Pty Ltd disclaims liability for any errors, omissions,
>>>>>> viruses,
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>> loss
>>>>
>>>>
>>>>
>>>>
>>>>>>
>>>>>>
>>>>> and/or damage arising from using, opening or transmitting this
>>>>> email.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>> If you are not the intended recipient you must not use,
>>>>>> interfere with,
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>> disclose, copy or retain this email and you should notify the sender
>>>>> immediately by return email or by contacting Sensis Pty Ltd by
>>>>> telephone
>>>>>
>>>>>
>>> on
>>>
>>>
>>>>> [+61 3 8653 5000]
>>>>>
>>>>>
>>>>>
>>>>>
>>>
>>>
>>>
>>> -------------------------------------------------------
>>> SF email is sponsored by - The IT Product Guide
>>> Read honest & candid reviews on hundreds of IT Products from real
>>> users.
>>> Discover which products truly live up to the hype. Start reading now.
>>> http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
>>> _______________________________________________
>>> Springframework-developer mailing list
>>> Spr...@li...
>>> https://lists.sourceforge.net/lists/listinfo/springframework-developer
>>>
>>>
>>>
>>> -------------------------------------------------------
>>> SF email is sponsored by - The IT Product Guide
>>> Read honest & candid reviews on hundreds of IT Products from real
>>> users.
>>> Discover which products truly live up to the hype. Start reading now.
>>> http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
>>> _______________________________________________
>>> Springframework-developer mailing list
>>> Spr...@li...
>>> https://lists.sourceforge.net/lists/listinfo/springframework-developer
>>>
>>>
>>
>>
>>
>> -------------------------------------------------------
>> SF email is sponsored by - The IT Product Guide
>> Read honest & candid reviews on hundreds of IT Products from real
>> users.
>> Discover which products truly live up to the hype. Start reading now.
>> http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
>> _______________________________________________
>> Springframework-developer mailing list
>> Spr...@li...
>> https://lists.sourceforge.net/lists/listinfo/springframework-developer
>>
>>
>>
>> -------------------------------------------------------
>> SF email is sponsored by - The IT Product Guide
>> Read honest & candid reviews on hundreds of IT Products from real
>> users.
>> Discover which products truly live up to the hype. Start reading now.
>> http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
>> _______________________________________________
>> Springframework-developer mailing list
>> Spr...@li...
>> https://lists.sourceforge.net/lists/listinfo/springframework-developer
>>
>>
>
>
>
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products from real users.
> Discover which products truly live up to the hype. Start reading now.
> http://ads.osdn.com/?ad_ide95&alloc_id396&op=click
> _______________________________________________
> Springframework-developer mailing list
> Spr...@li...
> https://lists.sourceforge.net/lists/listinfo/springframework-developer
|