0

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

JB Nizet
  • 678,734
  • 91
  • 1,224
  • 1,255
Rafeek Muhammed
  • 133
  • 2
  • 3
  • 13

1 Answers1

1

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.

Community
  • 1
  • 1
JB Nizet
  • 678,734
  • 91
  • 1,224
  • 1,255
  • I used columnDefinition attribute but after creating db shows descriptions of the attribute as default 'Y' but after inserting data it changed as unambigous symbol like a square – Rafeek Muhammed Oct 21 '11 at 07:01