Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[dali-dev] [Fwd: annotation fixes]

FYI

See part relating to AttributeOverrides below

- Paul

-------- Original Message --------
Subject: annotation fixes
Date: Fri, 13 Jan 2006 22:56:55 -0500
From: Mike Keith <michael.keith@xxxxxxxxxx>
To: ejb3-experts@xxxxxxx <ejb3-experts@xxxxxxx>


Hi,

I'd like to get people's opinion on a couple of annotation fixes.

1. The flushmode is currently defined to be set on an EntityManager 
or on a query. There is no annotation target for setting EntityManager 
config, but we obviously do have it for the query. The only use for 
FlushMode, then, might be as an element within @NamedQuery and 
@NamedNativeQuery. We would have a choice of a) defining a flushMode 
element which would require a DEFAULT value, or b) using a hint. 

The first option would produce an annotation like the following:

public @interface NamedQuery {
	String name();
	...
	FlushModeType flushMode() default DEFAULT;
}
public enum FlushModeType { AUTO, COMMIT, DEFAULT }

The second option would be to define a standard query hint 
javax.persistence.flushmode. Then the hint could be used in both the 
runtime API as well as the annotations. We would not need the setFlushMode 
call on the query anymore.

2. The @AttributeOverride annotation has "name" and "Column" elements 
and is meant to override attributes in an embedded object or attributes
inherited from a mapped superclass. The problem is that if we want to 
override a many-to-one relationship mapping then there is no place to
put a JoinColumn. We have two options:

a) Add a JoinColumn[] element to AttributeOverride and let it be ignored 
for all of the cases where a relationship is not being overridden, i.e. 
either Column or JoinColumn[] would be used, but never both. The problem
is that the Column element would become optional, so we would need to have
some kind of default value for the Column annotation, meaning the return
of the "specified" hack in Column.

b) Create another annotation pair (JoinColumnOverride[s]?) defined as:

public @interface JoinColumnOverride {
	String name();
	JoinColumn[] joinColumns();
}

If we chose this name we might rename AttributeOverride to ColumnOverride
for consistency.

Thoughts?

If anybody has an option c) that they like more than either a) or b) in 1. 
or 2. then please speak up!

-Mike



Back to the top