Basically I'm querying a table like the following
keywordId | keyword
1 abc
1 abcd
2 feg
2 xyz
2 tuv
When I pass a query such as:
"FROM keyword Where keywordId = 2"
I get back the following:
2 feg
2 feg
2 feg
Here's the method I'm using
public List<DataModel> selectRecord(String sqlQuery) {
SessionFactory factory = new Configuration().configure().buildSessionFactory();
Session session = factory.openSession();
session.beginTransaction();
Query query = session.createQuery(sqlQuery);
List<DataModel> data = query.list();
session.clear();
session.close();
return data;
}
Honestly not too sure why this is happening, but it's also occuring in other tables with the same structure may FK's
Insight appreciated! :)