/*
 * This file is subject to the terms and conditions defined in file 'LICENSE.txt', which is part of this source code package.
 */

package won.owner.repository;

import java.net.URI;

import org.springframework.data.jpa.repository.Query;

import won.owner.model.User;
import won.protocol.repository.WonRepository;

/**
 * User: t.kozel
 * Date: 11/7/13
 */
public interface UserRepository extends WonRepository<User> {

	public User findByUsername(String username);

  //for the syntax, this helps: http://en.wikibooks.org/wiki/Java_Persistence/Querying#JPQL
  @Query(value = "SELECT u from User u JOIN u.userNeeds n where n.uri = ?1")
  public User findByNeedUri(URI needUri);

}

@@ -162,30 +162,8 @@
 y;%0A%0A
-import java.net.URI;%0A%0A
 impo
@@ -208,25 +208,24 @@
 tory.Query;%0A
-%0A
 import won.o
@@ -288,16 +288,38 @@
 itory;%0A%0A
+import java.net.URI;%0A%0A
 /**%0A * U
@@ -674,10 +674,176 @@
 dUri);%0A%0A
+  @Query(value = %22SELECT u from User u JOIN FETCH u.keystorePasswordHolder where u.username = ?1%22)%0A  public User findByUsernameWithKeystorePassword(String username);%0A
 %7D%0A

implement join fetch method