Created
February 14, 2012 09:07
-
-
Save vojkny/1824989 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* what I would like to achieve: */ | |
public interface ItemRepository<T> { | |
@Query("select distinct a from " + TABLE_NAME + " a " + "join ti.tags tt where tt = ?1") | |
public List<T> findByTag(Tag t); } | |
} | |
public interface AaaaRepository extends ItemRepository<Aaaa> { | |
TABLE_NAME = "Aaaa"; | |
} | |
/* what we have: */ | |
public interface ItemRepository<T extends Item> extends BaseRepository<T> { | |
final static String DISTINCT_ITEM = "select distinct ti from "; | |
final static String BY_TAG = "join ti.tags tt where tt = ?1"; | |
public List<T> findByTag(Tag tag); | |
} | |
public interface AaaaRepository extends ItemRepository<Event> { | |
final static String ITEM = "Aaaa"; | |
@Override | |
@Query(DISTINCT_ITEM + ITEM + BY_TAG) | |
public List<Aaaaa> findByTag(Tag tag); // duplicate | |
} | |
public interface BbbbRepository extends ItemRepository<Event> { | |
final static String ITEM = "Bbbb"; | |
@Override | |
@Query(DISTINCT_ITEM + ITEM + BY_TAG) | |
public List<Bbbb> findByTag(Tag tag); // duplicate | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment