This week's book giveaway is in the Java in General forum.
We're giving away four copies of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 and have ishori Sharan & Adam L Davis on-line!
See this thread for details.
Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!

taylor kiani

+ Follow
since Aug 17, 2012
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by taylor kiani

yeah i solved many problemes after that but it seems that i havn't figured it out completely :p.
any way this time i am not trying to delete it from a parent entety and it is not the parent to any entity.

for the statu it's not null i sysouted it before deleting!
Hi everybody,
i'm getting this error when i try to delete a record in my datatable ;

#{PersonneRecontreeBean.delete}: org.hibernate.PropertyValueException: not-null property references a null or transient value: Dac.Entity.Audit.statu

i'm gussing it has to do with the way i structure my entetys so let me explain how it goes:

i have an entety "audit"

the entety i'm trying to delete:

and the entety where it is pointing in the error

and if it should help the entire error:

i'm nnot sure where the probleme is!
thank you for your time!
i chenged it because someone suggested it!

but anyway it works now , i used the example of Bill Gorder (defenetly learned a couple of things) and it worked, so thank you a lot and to everybody else.
if i remove the annotations from item like this:

the type of the feild division created in the ddl is tinyblob :s and their for it is not recongnised in my program!

oh and when i try to use it with the old database, then i can't list the divisions using SessionFactory.getCurrentSession().createQuery("FROM Division").list();

in both cases i get

août 26, 2012 10:44:27 AM org.hibernate.type.NullableType nullSafeGet
Infos: could not read column value from result set: division2_0_; could not deserialize
août 26, 2012 10:44:27 AM com.sun.faces.application.view.FaceletViewHandlingStrategy handleRenderException
Grave: Error Rendering View[/listDivision.xhtml]
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'DivisionBean': Invocation of init method failed; nested exception is org.hibernate.type.SerializationException: could not deserialize

i'm starting to think their must be somthing else that i am doing wrong, that causes the child entitys not to be deleted with the parent entity. is their any other reason that can cause this problem?
thank you
okey so i'm back, i tried to apply a OneToMany relation in Division for Item like james said but it didn't change anything i'm still getting that Cannot delete or update a parent row error, i alse made sur i have the CascadeType.Persist
here is how it looks now

and division:
okey her's the code for the class division:

the class item again:

and finaly a division can contain 0 or many items. voila
actualy a get the error when i try to delete the division and yes many item can refere to the same division so when i try to delete a division all the items atached to it are deleted as well.
change my cascade type to what exactly? like i'v said i alredy tried a few and no luck.
excuse my questions, this is my first time with an ORM
that precisely the probleme, cascade is not working and i can't figure out why!
but doesn't cascade = CascadeType.ALL cover them all (persist, remove ...). the reason why i'm cheking the DDL is because when i delete the adresse in your example (knowing that it's attached to a person)
I will end up with an foreing key error : Cannot delete or update a parent row: a foreign key constraint fails (`dac_bd4`.`item`, CONSTRAINT `FK317B1335EE5A98` FOREIGN KEY (`IDDIVISION`) REFERENCES `division` (`IDDIVISION`))

here is the entire error log:

when i said i'll do it manually i mean befor deleting the adresse i'm going to delete every person that has that adresse then delete the adresse (i realise it's not the best way to do it :s ... ).
thank you for your time!

Edit - Removed long lines to prevent horizontal scrolling
:s still no cascade but thank you for the links, learned a couple of new things .
i think i might do this manually (delete the parent befor the child object) their's so much changes that happen so the database should be possible to generate from the classes.
okey so what attributes should i add to get the cascad option.
i forgot to add that i already tried
@OnDelete(action = OnDeleteAction.CASCADE)
yes it is like William P O'Sullivan said there is no ON CASCADE defined as a constraint.
here's the DDL:

like i said i only gave one examble of the entity, because i use the same logic in them all so their is no point of repeating.
hii guys,
i'm using hibernate annotations in my project,
I've created the tables and it's all good except that when i check the database their's no cascade even tho I've made sure to put it in the classes.
here is an exemple of how i do it :

i'm using mysql database, here's the hibernate.cfg.xml:

and the application-context.xml:

what am i doing wrong ?
thank you!