![](/img/trans.png)
[英]How to update other table when inserting with OneToOne using Spring JPA
我有兩個表以 OneToOne 關系連接,一側存在於數據庫中。 當我插入另一側時,我希望第一側的外鍵列更新,以便它知道關系而不必手動執行。 這可能嗎。 這是我的簡化示例,我使用的是@MappedSuperclass,因為我在大多數實體中都有一些共享字段,我將其包含在此處以防萬一它引起問題。 基礎實體 ...
[英]How to update other table when inserting with OneToOne using Spring JPA
我有兩個表以 OneToOne 關系連接,一側存在於數據庫中。 當我插入另一側時,我希望第一側的外鍵列更新,以便它知道關系而不必手動執行。 這可能嗎。 這是我的簡化示例,我使用的是@MappedSuperclass,因為我在大多數實體中都有一些共享字段,我將其包含在此處以防萬一它引起問題。 基礎實體 ...
[英]Sensio ParamConverter STI abstract
賞金將在 4 小時后到期。 此問題的答案有資格獲得+50聲望賞金。 jo-chris正在從有信譽的來源尋找答案。 給定位置 -> A 和位置 -> B 的單個表 Inheritance 在 Controller 中,我將發送 A 或 B 類型的擴展位置。 Doctrine 告訴我它 ...
[英]Rails How to create a Model, Controller and View using Inheritance?
我正在開發這個在模型上使用繼承的應用程序,但它在視圖上收到以下錯誤消息: BankTransfer 類的超類不匹配 我使用腳手架命令創建了一個名為“payment_methods”的 MVC: 在模型文件payment_method.rb中,我包含了以下類: 使用 rails 控制台,使 ...
[英]Managing polymorphic data in Rails
我有一個用戶可以創建許多鏈接的應用程序,每個鏈接可以存儲不同類型的數據,具體取決於它是什么類型的鏈接。 例如,TelephoneLinkData 存儲電話號碼,EmailLinkData 存儲電子郵件地址、主題和正文。 每個鏈接也有一些共同的字段,例如對用戶的引用和名稱。 我試圖盡可能干凈地將其映 ...
[英]Updating an entity's type in TypeORM single table inheritance
有沒有辦法將繼承實體的類型(在數據庫中)更改為不同的實體類型? ...
[英]Update entity type in TypeORM single table inheritance
假設我有一個實現typeorm TableInheritance (單表繼承)的Base實體,並且我有兩個派生實體: A和B 。 我希望能夠將A的實體類型更改為B 。 像這樣的東西: uid 是相同的,typeorm 不會讓我簡單地插入 \ 更新。 有人知道這樣做的方法嗎? 我目前的解決方 ...
[英]How to create multilevel inheritance strategy in hibernate
當我只有產品類和兩個使用繼承策略單表(產品->電子,花園)擴展產品的類時,它可以正常工作。但是如果我嘗試創建新的單表繼承關系(電子->智能手機,計算機),我有一個警告: 鑒別器列必須在根實體中定義,它將在子類中被忽略:com.example.demo.entity.Electron ...
[英]Set up many to many associations between classes in single inheritance table and another table
我在部門和研究人員之間的多對多關系中有一個名為關系的連接表。 我希望能夠通過執行Department.find(1).students來獲取學生列表,但我得到ActiveRecord::HasManyThroughSourceAssociationNotFoundError (Could not ...
[英]What does :_type_disabled at inheritance_column mean?
我剛剛在 Rails 的一些 model 中遇到了這樣一行: 它有什么作用? ...
[英]JPA single-table inheritance mapping and two relationships to sub classes fails with unexpected result (Hibernate )
我們有一個簡單的單表映射,一艘附有圖像和文檔(附件的子類)的船: 我為 Hibernate 創建了一個測試用例: 失敗: 這里發生的是獲取所有類型的子類實例(大小 5),這是錯誤的(應該是 2 個圖像和 3 個文檔)。 此測試在所有 Hibernate 5.x 分支、5.3、5.4、5.5 和 5 ...
[英]How to filter inherited Doctrine objects?
每個Product都由給定Tenant (即用戶)“擁有”,並且需要一種顏色,該顏色可以是所有租戶可用的標准Color ,也可以是給定租戶創建且僅供該租戶使用的專有TenantOwnedColor 。#[ORM\Entity] class Product implements BelongsToT ...
[英]Update nested attributes objects independently from parent model
我有一個父 model 'page'和嵌套屬性model 'page_modules'同時由'單表繼承'模式建模。 我的問題是,當我嘗試保存不同生成'page_modules'時,如果其中一個未驗證,則整個 model 和嵌套屬性都不會更新,即使其中一些嵌套屬性通過了驗證。 ¿ 有沒有辦法更新所有 ...
[英]Hibernate single table inheritance - base class nested as a property inside a subclass throws PropertyAccessException
我有以下 class 結構和 2 個基類(過濾器和映射)。 @Entity public abstract class Filter { } @Entity public class AFilter extends Filter { } @Entity public class BFilter e ...
[英]Table design - modelling hierarchy issues where 2 1:many entities both relate to a third table
這是(我認為)一個通用問題,但這是一個具體的例子。 假設: 每個Albums都有 1-n Tracks 。 每首Track都在一個Album中。 (即使“ Logging with the Bloggs ”出現在Bloggs 的 First Album和Bloggs 的 Greatest Hit中 ...
[英]Rails STI and the "type" field
我跟蹤了一些資料來弄清楚如何在 Ruby On Rails 中實現單表 Inheritance。 我使用的具體示例只涉及 2 種類型的用戶: RegularUser和Admin繼承自User model ,其中包含一些字段,例如username 。 User model 中的字段之一是用戶的類型, ...
[英]Is there is any support for Single Table Inheritance in Prisma?
我在 Rails 中有一個項目,我在用戶表上使用單表 Inheritance,為用戶表創建兩個角色 - 1.Clinician 和 2.Patient。 model 描述。 在下面 class 患者 < 用戶 has_many:clinician_patients has_many:cli ...
[英]Symfony Doctrine - InheritanceType SINGLE_TABLE is not changing target Entity when Dicscriminator changes but not Id
我正在嘗試使用 doctrine 處理遺留數據庫。不同表中有許多字段是引用唯一代碼表 CHOIXCOD 的代碼。 該表依賴於兩個鍵。 與鏈接字段中的值對應的鍵 (CC_CODE),以及標識第一個鍵針對哪個字段的類型代碼 (CC_TYPE)。 因此,我在針對此代碼表的抽象實體上使用了 Doctrine ...
[英]Hibernate (JPA) inheritance with One-To-Many
我正在構建一個規則引擎系統,我希望允許用戶獲取他們請求的規則和他們作為通知收件人訂閱的規則我正在努力編寫一個查詢,通過給定用戶名獲取用戶名請求的所有規則,或者他在通知中列出由於我在 Hibernate + Spring JPA 中有點新,我很難確定這是設計不佳還是缺乏構建復雜查詢的知識我的方案描述如 ...
[英]Rename single table inheritance rails model class name without changing existing data
我有一個要重命名的ActiveRecord STI 子類(區分大小寫的更改)。 但是,如果我更改子類ActiveRecord的 class 名稱,則無法再實例化現有記錄,因為舊的 class 名稱位於基表的type列中。 如何在不更改數據庫內容的情況下更改 class 的名稱,以使重命名的影響最小。 ...
[英]When using discriminator value for single table strategy, the first inserted entity's discriminator value is null but the value is there in database
當將鑒別器值用於繼承/單表策略時,第一個插入實體的鑒別器值為空,但該值在數據庫中。 我必須重新啟動服務器,以便查詢結果包含鑒別器值: 如果我只是添加一個新的普通用戶(子實體),然后查詢這個用戶類型將為空的用戶: 我使用 eclipse-link 作為 JPA 實現和 Java EE 三層 ...