In the Hibernate perspective, I successfully create a configuration, attach to my database, etc.
I create mappings, the mappings work. I write an HQL query in the HQL query window. The query is fairly complicated, but executes successfully from that window. But the Hibernate Dynamic SQL preview shows "Session factory not created for configuration:hibernate". No error appears in the Eclipse Error Log window.
Code:
from NewRouteSchedule as r
inner join fetch r.routeScheduleTimeslots as ts
where ts.endingHour =
(select min(rs.endingHour) from RouteScheduleTimeslot as rs
where rs.newRouteSchedule.id = ts.newRouteSchedule.id
and hour(current_time) <= rs.endingHour)
and r.defaultFor like concat('%',dayname(current_date),'%')
and r.userGroupId = :userGroupId
My suspicion is that the defaultFor is what's throwing it off.
It is mapped as follows:
Code:
<property name="defaultFor" type="string">
<column name="DefaultFor" length="72" />
</property>
But in the database (MYSQL 5.1 and 4.21) the table schema uses the MYSQL Set datatype:
Code:
CREATE TABLE `NewRouteSchedule` (
`RouteScheduleID` int(10) NOT NULL default '0',
`UserGroupID` int(10) NOT NULL default '0',
`ExceptionDate` date default NULL,
`DefaultFor` set('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday') default NULL,
PRIMARY KEY (`RouteScheduleID`),
KEY `UserGroupID` (`UserGroupID`),
CONSTRAINT `NewRouteSchedule_ibfk_1` FOREIGN KEY (`UserGroupID`) REFERENCES `UserGroups` (`UserGroupID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
Again, this query works successfully in both the Hibernate Tools HQL window and in the field, but simply fails to show the SQL.
Other queries do not have this problem. Is this a bug? You would think if the plugin could execute the query successfully, it could generate the SQL in the window.