Package NTNU.IDATT1002.repository
Class TagRepository
java.lang.Object
NTNU.IDATT1002.repository.AbstractRepository<Tag,java.lang.Long>
NTNU.IDATT1002.repository.TagRepository
- All Implemented Interfaces:
Repository<Tag,java.lang.Long>
public class TagRepository extends AbstractRepository<Tag,java.lang.Long>
Tag Repository.
Implementation of
AbstractRepository
which supports regular Create, Read, Update and Delete operations.- Version:
- 1.0 21.03.20
- See Also:
AbstractRepository
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
FIND_TAG_BY_NAME
Mapping to @NamedQuery 'find all albums by users username' defined inImage
Fields inherited from class NTNU.IDATT1002.repository.AbstractRepository
entityClass, entityManager, logger
-
Constructor Summary
Constructors Constructor Description TagRepository(javax.persistence.EntityManager entityManager)
Set the class type toTag
-
Method Summary
Modifier and Type Method Description Tag
findOrCreate(Tag tag)
Retrieves a tag if found and creates it if not.Methods inherited from class NTNU.IDATT1002.repository.AbstractRepository
delete, deleteById, findAll, findById, save, setEntityClass, update
-
Field Details
-
FIND_TAG_BY_NAME
public static final java.lang.String FIND_TAG_BY_NAMEMapping to @NamedQuery 'find all albums by users username' defined inImage
- See Also:
- Constant Field Values
-
-
Constructor Details
-
TagRepository
public TagRepository(javax.persistence.EntityManager entityManager)Set the class type toTag
-
-
Method Details
-
findOrCreate
Retrieves a tag if found and creates it if not. Does not allow null value or blank names.- Parameters:
tag
- the tag to retrieve- Returns:
- the tag if found, else the newly created one.
-