Cascade

problem with NHibernate one-to-many relationship Collection with cascade

给你一囗甜甜゛ 提交于 2019-12-20 05:46:20
问题 I have AssetGroup entity with has a one-to-many relation with Asset entity. There is a Entity base class which overrides Equals and GetHashCode . I am following the example of ch 20 parent child <?xml version="1.0" encoding="utf-8" ?> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="TestNHibernate" namespace="TestNHibernate.Models" auto-import="true"> <class name="AssetGroup"> <id name="Id" column="Id" type="guid"> <generator class="guid"></generator> </id> <property name="Name

My 'ON DELETE CASCADE ' does not work

本小妞迷上赌 提交于 2019-12-20 04:51:31
问题 I have got 3 tables: lt_hdefaults , lt_hperiods and lt_hrules . In lt_hdefaults , there is one row for a property for a particular year. In the lt_hperiods table, there could be more than one period, call them seasons. In the lt_hrules table, there could be more than one rule for each period. Now, what I could not make work: when the user deletes a record from lt_hdefaults , other data related to the deleted record should be removed from lt_hperiods and lt_hrules table. I am trying to achieve

My 'ON DELETE CASCADE ' does not work

无人久伴 提交于 2019-12-20 04:51:13
问题 I have got 3 tables: lt_hdefaults , lt_hperiods and lt_hrules . In lt_hdefaults , there is one row for a property for a particular year. In the lt_hperiods table, there could be more than one period, call them seasons. In the lt_hrules table, there could be more than one rule for each period. Now, what I could not make work: when the user deletes a record from lt_hdefaults , other data related to the deleted record should be removed from lt_hperiods and lt_hrules table. I am trying to achieve

in mysql, on delete cascade not working

余生长醉 提交于 2019-12-19 14:03:54
问题 similar to ON DELETE CASCADE not working in MySQL, but something is not right: The ANSI Way -- test delete cascade CREATE TABLE t1( id SERIAL PRIMARY KEY, data TEXT ); CREATE TABLE t2( id INT PRIMARY KEY REFERENCES t1(id) ON DELETE CASCADE, data2 TEXT ); INSERT INTO t1 VALUES(1, 'one'); INSERT INTO t2 VALUES(1, 'first'); DELETE FROM t1; SELECT * FROM t2; -- should have not rows - have one! use this all the time in postgres, but for some reason cannot get it going in mysql. I am slowly

使用在线段收缩(ONLINE SEGMENT SHRINK)回收浪费的段空间

南笙酒味 提交于 2019-12-19 13:23:23
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> ITPub博客 首页 博客 学院 社区 下载 登录 注册 使用在线段收缩(ONLINE SEGMENT SHRINK)回收浪费的段空间 原创 作者: 尛样儿 时间:2015-08-08 14:52:44 7917 0 ONLINE TABLE REDEFINITION(在线重定义表)(详见:《使用DBMS_REDEFINITION包执行在线重定义表(ONLINE TABLE REDEFINITION) 》: http://blog.itpub.net/23135684/viewspace-1765128/ )也可以完成数据空间的回收,但是ONLINE SEGMENT SHRINK更合适单纯的表空间回收,这篇文章将根据官方文档的内容讨论通过在线段收缩回收浪费的空间。 一.回收未使用空间的原理 随着时间的推移,针对表空间下对象的UPDATE和DELETE操作会产生个别空的空间,这些空间不是足够的大,没办法被新插入的数据使用。这种类型的空空间被认为是自由空间的碎片。 拥有自由空间碎片的对象存在空间的浪费,也会影响数据库的性能。首选的碎片整理和空间的回收方法是执行在线段收缩(online segment shrink),这个过程会将高水位线以下的自由空间的碎片整合到一起,把段压紧,压紧之后,高水位线可以移动

JPA + Hibernate: How to define a constraint having ON DELETE CASCADE

笑着哭i 提交于 2019-12-19 05:47:54
问题 I am just wondering if there's such a way that I can have build my MySQL table as ALTER TABLE `USERINFO` ADD CONSTRAINT `FK_USER_ID` FOREIGN KEY (`USERID`) REFERENCES `USERACCOUNT` (`USERID`) ON DELETE CASCADE ON UPDATE CASCADE; However, I only got this in my DDL when hibernate ++ jpa starts to build my table having " <property name="hibernate.hbm2ddl.auto" value="create" /> " ALTER TABLE `USERINFO` ADD CONSTRAINT `FK_USER_ID` FOREIGN KEY (`USERID`) REFERENCES `USERACCOUNT` (`USERID`); In my

Dependency Tracking function

这一生的挚爱 提交于 2019-12-18 17:31:46
问题 I just wonder if anyone knows how to automatize views creation after running DROP ... CASCADE ? Now I'm trying to drop view at first with classic DROP VIEW myview statement and if I cannot drop the view because other objects still depend on it then checking out all the objects names that postgres lists and save their creates and then I run drop with cascade. Sometimes it's like over a dozen objects. But maybe you have got some idea to handle this issue in more automated way? Maybe anybody has

Is SQL Server DRI (ON DELETE CASCADE) slow?

寵の児 提交于 2019-12-18 16:39:06
问题 I've been analyzing a recurring "bug report" (perf issue) in one of our systems related to a particularly slow delete operation. Long story short: It seems that the CASCADE DELETE keys were largely responsible, and I'd like to know (a) if this makes sense, and (b) why it's the case. We have a schema of, let's say, widgets, those being at the root of a large graph of related tables and related-to-related tables and so on. To be perfectly clear, deleting from this table is actively discouraged;

JPA Hibernate many-to-many cascading

北城以北 提交于 2019-12-18 10:01:45
问题 I am using JPA 2.0 and hibernate. I have a User class and a Group class as follows: public class User implements Serializable { @Id @Column(name="USER_ID") private String userId; @ManyToMany @JoinTable(name = "USER_GROUP", joinColumns = { @JoinColumn(name = "GROUP_ID") }, inverseJoinColumns = { @JoinColumn(name = "USER_ID") } ) private Set<Group> groupList; //get set methods } public class Group { @Id @Column(name="GROUP_ID") private String groupId; @ManyToMany(mappedBy="groupList") private

Fluent NHibernate one-to-one doesn't have cascade all-delete-orphan

一个人想着一个人 提交于 2019-12-18 09:03:26
问题 I am in the process of updating the existing *.hbm.xml files into fluent ClassMaps and have stumbled on a mistake in our mapping files, and I don't know the default behavior for me to map this correctly. The mapping file has: <one-to-one name="LineItemAssembly" class="LineItemAssembly" cascade="all-delete-orphan" /> When using Fluent, I would expect this to map to: HasOne<LineItemAssembly>(x => x.LineItemAssembly) .Cascade.AllDeleteOrphan(); However, AllDeleteOrphan() is not an option off of