I am trying to make a simple query to get a unique result in hibernate, here is my code.
public String getName(Integer id) { Session session = getSessionFactory().openSession(); String name = (String)session.createSQLQuery("SELECT name FROM users WHERE user_id = :userId").setParameter("userId", id).uniqueResult(); return name; }
The return name is saved as HTML text, which includes the html syntax language. I think this is what causes the problem, but it does not make sense. I just want to return it as a string.
This only happens in this name of one field, I can get every other field in the string, but it gives me an error.
I get an exception. The exception that I get is
No dialect display for JDBC type: -1; Nested Exception - org.hibernate.HibernateException
How do you query a specific column in a row in sleep mode?
source share