cost 390 ms
MongoDB - 插入 2 個文檔,每個文檔都在另一個集合中,但共享 ObjectId

[英]MongoDB - Insert 2 documents, each in another collection but share ObjectId

我有這個問題:我想將2個文檔插入到2個collections中。 一種用於用戶,一種用於公司。 通過 api 請求這兩個插頁。 在 created(Inserted) 公司中,我想知道哪個用戶 [Created/inserted] 創建了這家公司。 在用戶中,我想擁有他插入的公司的 _id。 用戶 ...

在 Kubernetes 中分配和維護順序 Worker-Number 或 NodeId

[英]Assign and maintain sequential Worker-Number or NodeId in Kubernetes

當 Kubernetes Spring-Boot 應用以 8 個實例啟動時,每個節點中運行的應用需要獲取 pod/容器的序列號。 運行相同應用程序的 pods/容器不應有重復的數字。 假設一個 pod 運行一個容器,一個容器只運行一個應用程序實例。 應用程序可以從 Kubernetes API 為 ...

在 C# 的構造函數中分配遞增的 uint ID

[英]Assign Incrementing uint ID in constructor in C#

我有一個 class 據說可以處理 uint 類型的唯一 ID 的生成。 然而,在多次使用后,uint 值似乎並沒有增加。 這個 class 用於在其他類上調用它時分配一個唯一的 integer ID。 例如,下面的兩個示例構造函數都有一個 ID 屬性,該屬性應該從 UniqueIdGenerat ...

Hibernate:每個實體都有自己的 ID 生成器序列

[英]Hibernate: Own ID-Generator Sequence for every entity

我目前使用這種方法來生成 id: 結果是,當我保存類型 A 的實體時,它獲得 id '1',然后我保存實體 B 並獲得 id '2'(而不是 1,因為它是另一個實體類型),然后我保存類型的實體A 再次獲得 id '3'(而不是 2)。 我想要的是,Hibernate 計算每個實體類型的 ID 序列。 ...

在 Oracle Golden Gate 上按序列生成 ID

[英]ID Generation by Sequence On Oracle Golden Gate

在我的 Oracle 19c Golden Gate 集群上,不同地理位置的兩個實例同時運行。 (主動-主動) 在我的應用程序代碼中,我需要生成 ID,我更喜歡使用 Oracle 序列(nextval 函數)。 Oracle 金門不保證在不同站點生成不同的值。 由於存在在不同站點上生成相同 n ...

如何使用 JdbcTemplate(或普通 JDBC)從 Oracle 獲取帶有小寫字符的列的生成密鑰

[英]How to get the generated key for a column with lowercase characters from Oracle using JdbcTemplate (or plain JDBC)

如果我創建這樣的表:create table standard ( id NUMBER GENERATED by default on null as IDENTITY PRIMARY KEY, text varchar2(200) ) 我可以插入一些數據並使用這樣的方法取回生成 ...

如何手動設置@GeneratedValue 的值

[英]How to manually set a value for @GeneratedValue

使用 Spring Data JPA 進行 Spring Boot。 Postgres 數據庫。 一般實體: 當我嘗試使用指定的id值創建一個條目時,結果我看到它被@GeneratedValue忽略並生成。 如何克服這一點? ...

org.hibernate.MappingException:序列的增量大小在實體映射中設置為 [10] 而...大小為 [1]

[英]org.hibernate.MappingException: The increment size of the sequence is set to [10] in the entity mapping while ... size is [1]

我們在更新到 Spring Boot 2.2 和相關的 Hibernate 5.4.x 時遇到了問題。 我們確實有以下序列生成器 隨着更新到 SB 2.2 / HB 5.4,我們得到以下初始化錯誤 DB 序列增量大小為 1: 但是,據我了解,hilo 算法的(軟)增量大小與數據庫的( ...

使用 etcd 集群生成序列號

[英]Sequential number generation with etcd cluster

我正在探索 etcd 來實現分布式環境的序列號生成器。 我的要求是生成不重復的序列號,用於同一應用程序的多個實例的每個請求中。 並且可以有n個這樣的應用程序的要求。 我使用golang 客戶端包中提供的 STM 和互斥鎖以多種方式為此做了 POC 在本地機器設置中使用單節點 etcd 服務器(將是 ...

模式驗證:使用休眠序列生成器策略時缺少表[SEQUENCE_NAME]

[英]Schema-validation: missing table [SEQUENCE_NAME] when using Hibernate Sequence Generator Strategy

我在休眠ID生成和ms sql服務器方面遇到一些問題。 我在應用程序中使用GenerationType.SEQUENCE生成具有休眠狀態的ID。 作為數據庫,我使用Microsoft SQL Server 2017。 我通過Liquibase創建序列: 啟動Sprin ...

Spring JPA-序列緩存提供了意外的行為。 使用分配大小= 1可以

[英]Spring JPA - sequence caching gives unexpected behaviour. Using allocation size = 1 is ok

我的Spring Boot應用程序使用ao 2 Entity類。 實體類別1使用的技術密鑰ID使用序列。 實體包含其他實體的列表,因此是一對多的。 子實體使用相同的序列。 使用20的序列分配(緩存)大小,我看到得到EntityExistsException: javax.p ...

org.hibernate.id.IdentifierGenerationException:此類的ID必須在調用save()之前手動分配:com.app.entites.LDetails

[英]org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before calling save(): com.app.entites.LDetails

我嘗試了很多次使用以下代碼在表中插入id值,但是它總是拋出org.hibernate.id.IdentifierGenerationException:此類的id必須在調用save()之前手動分配:com.app.entites.LDetails 以下是實體類中的代碼 我已經使用I ...

從JavaScript中的一組已知潛在ID創建唯一字符串ID /密鑰的快速方法

[英]Fast way to create a unique string ID/key from a known set of potential IDs in JavaScript

假設您要使用一組1到2位的十六進制數字,即256個數字。 只需使用一小組即可解決問題,但它適用於任何大小的字符串。 因此,在這種情況下,您可能有 N或256個數字。 您將為自己出現的每個新數據記錄“生成”一個新ID。 因此,它開始於,並隨機地給您af , 1d , 8a等 最簡 ...

用於 C# 類層次結構的 MongoDb 順序 int id 生成器

[英]MongoDb sequential int id generator for C# class hierarchy

我有一個帶有分離的 BsonClass 映射的 C# 類層次結構。 我所有的課程都使用自定義順序 int id 生成。 最后一個 ID 存儲在稱為“計數器”的特殊集合中。 我的問題是當拋出像 InsertOneAsync 這樣的 mongo 收集方法被稱為 InvalidCastException ...

文檔的路徑與Firestore自動生成的隨機ID有關系嗎?

[英]Does the path of a Document have any bearing on the random ID auto-generated by Firestore?

如果我想在將文檔保存到Firestore 之前了解其文檔(隨機)(不編寫自定義代碼),可以執行以下操作: 如果我在上面的代碼中輸入"collection-name" ,但使用該id將文檔保存到"some-other-collection"集合中,會"some-other-collecti ...

在Oracle數據庫上持久保存具有非自動增量ID的實體時引發DataRetrievalFailureException

[英]DataRetrievalFailureException thrown when persisting entity with a non auto-increment id on Oracle database

我將Spring Data JDBC與Oracle數據庫一起使用,並使用BeforeSaveEvent處理器在我的實體上設置了自定義ID。 當我嘗試保留該實體時,將引發以下異常。 如何配置生成的鍵列以避免此異常,或者如何配置不需要生成的鍵? ...

如何插入自定義ID使用Spring數據jdbc的記錄?

[英]How to insert a record with custom id use Spring data jdbc?

對於Spring 數據JPA,我可以使用@GeneratedValue(strategy = GenerationType.AUTO)插入一條帶有自定義id 的記錄,但是對於Spring 數據JDBC,我如何插入一條帶有自定義id 的記錄? 我試圖用 id 插入,但沒有拋出異常,記錄也沒有插入到表 ...

如果我們使用身份ID生成器,並且仍將主鍵設置為實體對象,那么哪個主鍵將存儲在數據庫中?

[英]If we are using `identity` ID Generator and still we set the primary key to the entity object then which primary key will be stored in the database?

眾所周知,如果我們在Hibernate中使用identity ID生成器,並且不將主鍵值設置為實體對象,那么數據庫將插入主鍵值。 但是,如果我們使用identity ID生成器,並且仍將主鍵值設置為諸如entityClassObject.setPrimaryKeyNo(10)類的實體 ...


 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM