package <%=packageName%>.repository;

import <%=packageName%>.domain.User;

import org.joda.time.DateTime;<% if (databaseType == 'sql') { %><% if (javaVersion == '8') { %>
import org.springframework.data.repository.Repository;
import java.util.Optional;<% } else {%>
import org.springframework.data.jpa.repository.JpaRepository;<%}%>
import org.springframework.data.jpa.repository.Query;<% } %><% if (databaseType == 'nosql') { %>
import org.springframework.data.mongodb.repository.MongoRepository;<% } %>

import java.util.List;<% if (javaVersion == '8') { %>
import java.util.Optional;<%}%>

<% if (databaseType == 'sql') { %>/**
 * Spring Data JPA repository for the User entity.
 */<% } %><% if (databaseType == 'nosql') { %>/**
 * Spring Data MongoDB repository for the User entity.
 */<% } %><% if (javaVersion == '8') { %>
public interface UserRepository extends <% if (databaseType == 'sql') { %>Repository<% } %><% if (databaseType == 'nosql') { %>MongoRepository<% } %><User, String> {

    Optional<User> findOneByActivationKey(String activationKey);

    List<User> findAllByActivatedIsFalseAndCreatedDateBefore(DateTime dateTime);

    Optional<User> findOneByEmail(String email);

    Optional<User> findOneByLogin(String login);
    <% if (databaseType == 'sql') { %>
	Optional<User> save(User t);
	<% } else if (databaseType == 'nosql') { %>
	@SuppressWarnings("unchecked")
	User save(User t);
	<% } %>
    void delete(User t);

}<% } else { %>
public interface UserRepository extends <% if (databaseType == 'sql') { %>JpaRepository<% } %><% if (databaseType == 'nosql') { %>MongoRepository<% } %><User, String> {

    User findOneByActivationKey(String activationKey);

    List<User> findAllByActivatedIsFalseAndCreatedDateBefore(DateTime dateTime);

    User findOneByLogin(String login);

    User findOneByEmail(String email);

}<% } %>

@@ -1237,20 +1237,16 @@
 login);%0A
-    
 %3C%25 if (d
@@ -1272,17 +1272,20 @@
 ') %7B %25%3E%0A
-%09
+    
 Optional
@@ -1301,25 +1301,24 @@
 ve(User t);%0A
-%09
 %3C%25 %7D else if
@@ -1349,17 +1349,20 @@
 ') %7B %25%3E%0A
-%09
+    
 @Suppres
@@ -1384,17 +1384,20 @@
 ecked%22)%0A
-%09
+    
 User sav
@@ -1411,9 +1411,8 @@
 t);%0A
-%09
 %3C%25 %7D

fix generated UserRepository when using Java8 and MongoDB