[hibernate-dev] Interface for mapping classes : Programmatic API

Amin Mohammed-Coleman aminmc at gmail.com
Mon Dec 14 09:26:00 EST 2009


Hi

It seems as though my email may have been a bit too vague. So I'll try to
explain more or provide some more information to get some advice.

At present none of the mapping class extend any particular interface or
extend any abstract classes so it becomes difficult to a certain extent to
remember what methods need to be present at the entity/property level
mapping.

I know I have forgotten to add factory methods on some of the mapping
classes when they were required.  I was therefore thinking would it be
worthwhile introducing some form of interface that enforces the correct
factory methods are implemented if you are creating a property level mapping
or an entity level mapping.  So basically something in the lines of

public interface PropertyLevelMapping  {

  public FieldMapping field();

  public CalendarBridgeMapping calendarBridge(Resolution resolution);

 ....
}


public interface EntityLevelMapping {

  public FullTextFilterDefMapping fullTextFilterDef (Class<?> impl);

 .....
}

So if a mapping class applies to both entity and property level then the
mapping class would implement both.

Again I'm not sure if this the correct approach or there is something better
that can be used.

Hope this provides some more info and apologies for not making it more
clear!

Cheers
Amin

On Thu, Dec 10, 2009 at 8:12 PM, Amin Mohammed-Coleman <aminmc at gmail.com>wrote:

> Hi
>
> I was wondering whether to get some thoughts about the following:
>
> At present none of the mapping classes implement any interface or extend
> any abstract classes.  So I was thinking of introducing some form of
> interface for property level mapping so that one remembers (mostly me :)) to
> add all the methods required at the property level and the same for the
> entity level.  I'm not sure about this so it would be cool if I could get
> your thoughts or start some form of discussion around it.
>
>
> Cheers
>
> Amin
>



More information about the hibernate-dev mailing list