Help

Cedric and Bill have proposed solutions. My preference is basically similar to Bill's, but here's how I would write it:

<class name="org.hibernate.Item">
    @Entity
    @Table(name="AUCTION_ITEM")
    <method sig="getBar()">@Transient</method>
    <method sig="doSomething(int, String)">
        @Tx(REQUIRES_NEW)
    </method>
</class>

I like this, because the same approach can be used outside of the context of J2EE. I /really/ wish something like this would have been included in JSR-175.

6 comments:
 
24. Jul 2004, 02:43 CET | Link
it looks awfully like java code. is there any problem to just use java itself to define annotation overriding? it will be a skeleton class similiar to original one, with nothing but modified annotations.

ReplyQuote
 
24. Jul 2004, 10:30 CET | Link
Heiko W. Rupp
From having a quick look at the three referenced alternatives, this one looks best to me. I am not an expert though.
 
24. Jul 2004, 19:00 CET | Link
Baliuka Juozas
I think it is better to use java source file as metadata too, it can be like old good IDL.
 
28. Jul 2004, 13:30 CET | Link
Nicolas Dasriaux | nicolas.dasriaux(AT)neoxia.com
To me, it's the best and easier to read approach I've seen sofar.

It is very similar to 'in-source-code' annotations, and would look like 'out-of-source-code' annotations, if I may say so.

It would be an interesting way of specifying annotations outside of source code (if they are not specified in source), or override in-source-code annotations.

In that case, 'out-of-source' annotations would be something like a deployement descriptor ...

What do you think of that, Gavin ?

Regards

Nicolas Dasriaux
 
28. Jul 2004, 22:00 CET | Link
Larry
Looks like chinese to me.
 
29. Jul 2004, 13:17 CET | Link
Juozas baliuka
[code]
package org.hibernate;

@Entity
public interface Item{

  @Transient Bar getBar();

  @Tx(REQUIRES_NEW)
     void doSomething(int, String);

}
[/code]

This file format is more readable, is not it.
Post Comment