Question: I am trying to run a simple SQL(native) query within a hibernate application.

```
SELECT COUNT(*) from users

```

The answer to the select may be saved into a integer.
How can i do this without having to create a model class in Hibernate?

Answer: 
Hibernate 5.0.9.Final will give that result as a `BigInteger` type object. Assuming you have an `EntityManager`, then use:

```
BigInteger r = (BigInteger) em.createNativeQuery("select count(*) from user").getSingleResult();
System.out.println(r);

```

This is a simple question and you should be able to find the answer easily on stackoverflow:

[hibernate native query, count [duplicate]](https://stackoverflow.com/questions/13049137/hibernate-native-query-count).

[How do we count rows using Hibernate?](https://stackoverflow.com/questions/1372317/how-do-we-count-rows-using-hibernate)
```
Resultset rs=Statement.ExecuteQuery("SELECT COUNT(*) as number from users");
while(rs.next()){
 Long count =rs.getLong("number");
    }

```