Question: I have a dialog box that appears and while closing keyboard with `hideKeyboard();` all the form is closed and i get back to the home page so that i can't continue the scenario for filling other data. 

Here the screen : 

[![enter image description here](https://i.stack.imgur.com/oYjFR.png)](https://i.stack.imgur.com/oYjFR.png)

Answer: 
You can use `@Query` to selectively include some fields:

```
// Include all fields you wanna query for using u.x syntax
// AFAIK there is no exclusion syntatic sugar
@Query("select u.id, u.username from SpringUsers u where u.id = ?1")
List<SpringUsers> findByUserId(Integer userId);

```

Also you can use [Projections](https://docs.spring.io/spring-data/jpa/docs/current/reference/html/#projections). First define the projection by introducing a projection interface:

```
interface NoPasswordUser {
    Long getId();
    String getUsername();
    // Do not include getPassword();
}

```

Then use it in your repository:

```
public interface SpringUsersRepository extends CrudRepository<SpringUsers, Integer> {
    NoPasswordUser findByUsername(String username);
    List<NoPasswordUser> findByUserId(Integer userId);
}

```

Anyway, It's better to not expose your entities through a REST or any remote interface. You can use DTOs for that matter, this [post](https://stackoverflow.com/questions/17874688/what-is-a-good-strategy-for-converting-jpa-entities-into-restful-resources) may be useful in this area.
Use @JsonIgnore, this will make it available in the back but will not return when transforming to json

```
@Size(min = 8)
@JsonIgnore
private String password;

```