[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-6132?page=c...
]
Strong Liu edited comment on HHH-6132 at 5/13/11 8:44 AM:
----------------------------------------------------------
well, the reason i'd prefer mock annotation is that persistence-metadata-unit also can
define <entity-listeners>, and the idea i thought is we should get rid of XMLxxx
object at binder and above level
here is the prototype:
{code:xml}
<persistence-unit-metadata>
<persistence-unit-defaults>
<delimited-identifiers/>
<access>FIELD</access>
<entity-listeners>
<entity-listener
class="org.hibernate.metamodel.source.annotations.xml.mocker.ItemListener">
<pre-persist method-name="prePersist"/>
<post-persist method-name="postPersist"/>
</entity-listener>
</entity-listeners>
</persistence-unit-defaults>
</persistence-unit-metadata>
{code}
{code:java}
public interface MockedNames {
public static final DotName DEFAULT_ACCESS = DotName.createSimple(
"default.access" );
public static final DotName DEFAULT_DELIMITED_IDENTIFIERS = DotName.createSimple(
"default.delimited.identifiers" );
public static final DotName DEFAULT_ENTITY_LISTENERS = DotName.createSimple(
"default.entity.listeners" );
public static final DotName DEFAULT_POST_LOAD = DotName.createSimple(
"default.entity.listener.post.load" );
public static final DotName DEFAULT_POST_PERSIST = DotName.createSimple(
"default.entity.listener.post.persist" );
public static final DotName DEFAULT_POST_REMOVE = DotName.createSimple(
"default.entity.listener.post.remove" );
public static final DotName DEFAULT_POST_UPDATE = DotName.createSimple(
"default.entity.listener.post.update" );
public static final DotName DEFAULT_PRE_PERSIST = DotName.createSimple(
"default.entity.listener.pre.persist" );
public static final DotName DEFAULT_PRE_REMOVE = DotName.createSimple(
"default.entity.listener.pre.remove" );
public static final DotName DEFAULT_PRE_UPDATE = DotName.createSimple(
"default.entity.listener.pre.update" );
}
{code}
{quote}
Annotations:
default.delimited.identifiers:
(isMocked = true)
default.access:
(isMocked = true, value = FIELD)
default.entity.listeners:
(isMocked = true, value =
[org.hibernate.metamodel.source.annotations.xml.mocker.ItemListener])
default.entity.listener.pre.persist:
Method: void
org.hibernate.metamodel.source.annotations.xml.mocker.ItemListener.prePersist()
(isMocked = true)
default.entity.listener.post.persist:
Method: void
org.hibernate.metamodel.source.annotations.xml.mocker.ItemListener.postPersist()
(isMocked = true)
{quote}
was (Author: stliu):
well, the reason i'd prefer mock annotation is that persistence-metadata-unit also
can define <entity-listeners>, and the idea i thought is we should get rid of XMLxxx
object at binder and above level
here is the prototype:
{quote}
<persistence-unit-metadata>
<persistence-unit-defaults>
<delimited-identifiers/>
<access>FIELD</access>
<entity-listeners>
<entity-listener
class="org.hibernate.metamodel.source.annotations.xml.mocker.ItemListener">
<pre-persist method-name="prePersist"/>
<post-persist method-name="postPersist"/>
</entity-listener>
</entity-listeners>
</persistence-unit-defaults>
</persistence-unit-metadata>
{quote}
{quote}
public interface MockedNames {
public static final DotName DEFAULT_ACCESS = DotName.createSimple(
"default.access" );
public static final DotName DEFAULT_DELIMITED_IDENTIFIERS = DotName.createSimple(
"default.delimited.identifiers" );
public static final DotName DEFAULT_ENTITY_LISTENERS = DotName.createSimple(
"default.entity.listeners" );
public static final DotName DEFAULT_POST_LOAD = DotName.createSimple(
"default.entity.listener.post.load" );
public static final DotName DEFAULT_POST_PERSIST = DotName.createSimple(
"default.entity.listener.post.persist" );
public static final DotName DEFAULT_POST_REMOVE = DotName.createSimple(
"default.entity.listener.post.remove" );
public static final DotName DEFAULT_POST_UPDATE = DotName.createSimple(
"default.entity.listener.post.update" );
public static final DotName DEFAULT_PRE_PERSIST = DotName.createSimple(
"default.entity.listener.pre.persist" );
public static final DotName DEFAULT_PRE_REMOVE = DotName.createSimple(
"default.entity.listener.pre.remove" );
public static final DotName DEFAULT_PRE_UPDATE = DotName.createSimple(
"default.entity.listener.pre.update" );
}
{quote}
{quote}
Annotations:
default.delimited.identifiers:
(isMocked = true)
default.access:
(isMocked = true, value = FIELD)
default.entity.listeners:
(isMocked = true, value =
[org.hibernate.metamodel.source.annotations.xml.mocker.ItemListener])
default.entity.listener.pre.persist:
Method: void
org.hibernate.metamodel.source.annotations.xml.mocker.ItemListener.prePersist()
(isMocked = true)
default.entity.listener.post.persist:
Method: void
org.hibernate.metamodel.source.annotations.xml.mocker.ItemListener.postPersist()
(isMocked = true)
{quote}
Process and bind global configuration annotations
-------------------------------------------------
Key: HHH-6132
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-6132
Project: Hibernate Core
Issue Type: Sub-task
Components: metamodel
Reporter: Hardy Ferentschik
Assignee: John Verhaeg
Fix For: 4.0.0.Beta1
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira