FAQ Database Discussion Community


HQL sytax error

java,mysql,spring,hql,hibernate-4.x
mysql 5.1 hibernate 4.3 spring 4 glassfish 4 I have written a application using spring and hibernate. It gives following error. ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM Account...

getting empty objects while passing from controller to jsp

jsp,spring-mvc,hibernate-4.x
I have a problem when passing a list of objects from controller to jsp. here i the jsp page <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Users</title> </head> <body> <h1>User...

Hibernate event listeners for JPA callbacks

java,hibernate,jpa,hibernate-4.x
How can I enable the Hibernate event listeners, that handle JPA callbacks? Currently I am using using Hibernate 4 with SessionFactory configuration, but JPA callbacks are not running properly, when I persist an object. Any suggestion are most welcome. Source code Temp Entity class: package com.esp.entity; import javax.persistence.Entity; import javax.persistence.EntityListeners;...

Org.hibernate.HibernateException: createQuery is not valid without active transaction

java,spring,hibernate,spring-mvc,hibernate-4.x
Following this question, I am trying to add Hibernate 4.3.8.Final to Spring 4.1.5.RELEASE; but - The code throws an exception as following and at times throws - an exception that it cannot find entity class of hibernate (com.myproject.model.MyTable) although the class exists and is located in com.myproject.model package. StackTrace org.hibernate.HibernateException:...

java.lang.NullPointerException in session factory building hibernate 4

java,hibernate,session,sessionfactory,hibernate-4.x
I am simply trying to create a session factory object in hibernate 4. It throws null pointer exception while creating session factory object. Hibernate configuration file <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> <hibernate-configuration> <session-factory> <property name="connection.url">jdbc:oracle:thin:@SHKG9072DB:5030:TMSD10G2</property>...

Spring 4.1.5.RELEASE fails to do dependency injection for SessionFactory of Hibernate 4.3.8.Final

spring,spring-mvc,dependency-injection,hibernate-4.x
Question is not a duplicate as Hibernate is involved As the James' answer partially solved the problem, I accepted it and opened a new question, please follow up here I am trying to inject SessionFactory into a repository class; however, it looks like it does not work as the code...