简体   繁体   中英

Hibernate : Delete child entry using hql

Good Day to all,

I have a trouble in hibernate and i am a fresher in hibernate, i wish to delete a child entry using hql , if you have a solution please help me and now i am using pojo classes for creating the entities not xml mapping.

how can give a default value for a table attribute while creating new entity using class mapping (in pojo) not xml mapping

Thanks in advance

You normally don't use HQL to delete entities, but use session.delete(entity) . If you have a cascade remove set on the association (or a cascade all), the the child entity will be deleted along with the parent entity. Read the hibernate reference manual to learn more and see examples.

To specify a default value for a column when generating the schema using Hibernate, you might use the columnDefinition attribute of the Column annotation. I usually prefer to generate the database schema by hand , though.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM