Love to share,
Health to spare,
And friends that care.
got from a JIRA post
I hate using non-licensed tools. generally when it comes to code generation for Hibernate, pple tell of myeclipse; and heres the way to do it. Myeclipse usage requires licenses; so this is how pple get around it –uninstall it just before the trial expires and reinstall it again.
I hate all this crappy stuff and wanted a clean way to do it. I have used eclipse helios for this and guess it would work for other eclipse versions as well
Now the hibernate plugin is installed. Below i tell the steps to auto genrate the code
Now the qn: why did they build the plugin so complicated? why not have it a siimple one? all of it done in a wizard??? i donk know…
let me know if it helped you.
Below is the table def that caused the problem:
CREATE TABLE IF NOT EXISTS `T_ABC` (
`id` INT NOT NULL AUTO_INCREMENT ,
`source_col` int NOT NULL ,
PRIMARY KEY (`id`) ,
INDEX `fk_src_col` (`source_col` ASC) ,
CONSTRAINT `fk_src_col`
FOREIGN KEY (`source_col` )
REFERENCES `parent_table` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
and on execution it was giving the error ERROR 1005 (HY000): Can't create table schema.T_ABC.frm
The fix to issue is: that parent_table.id is of bigint type, while this table foreign key is only int; when i changed the source_col from int to big_int things went well.
hope this helps somebody.
So the problem stmt is as follows
Criteria criteria = getSession().createCriteria(CompositeKeyEntity.class);
criteria = criteria.add(Restrictions.in("id.subKey", list));
List<CompositeKey> list = criteria.list();
Let me know if it helps.