JP3857749B2 - Persistent object management unit - Google Patents

Persistent object management unit Download PDF

Info

Publication number
JP3857749B2
JP3857749B2 JP15656296A JP15656296A JP3857749B2 JP 3857749 B2 JP3857749 B2 JP 3857749B2 JP 15656296 A JP15656296 A JP 15656296A JP 15656296 A JP15656296 A JP 15656296A JP 3857749 B2 JP3857749 B2 JP 3857749B2
Authority
JP
Japan
Prior art keywords
group
objects
data
management device
persistent
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
JP15656296A
Other languages
Japanese (ja)
Other versions
JPH103422A (en
Inventor
裕子 中山
忠弘 上原
里枝子 山本
裕之 吉田
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Fujitsu Ltd
Original Assignee
Fujitsu Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Fujitsu Ltd filed Critical Fujitsu Ltd
Priority to JP15656296A priority Critical patent/JP3857749B2/en
Publication of JPH103422A publication Critical patent/JPH103422A/en
Application granted granted Critical
Publication of JP3857749B2 publication Critical patent/JP3857749B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Description

【0001】
【発明の属する技術分野】
本発明は,オブジェクト指向で記述されたソフトウェアにおいて,オブジェクトの永続性をリレーショナル・データベース管理システム(以下,RDBMSという)で実現する場合に,オブジェクトのグループ単位でRDBMSとのアクセス(取り出し,保存,ロック,ロック解除等)を行う永続オブジェクト管理装置に関し,これにより,関連する永続オブジェクト間の一貫性を保持することを可能にしたものである。
【0002】
【従来の技術】
永続オブジェクトとは,一時的に生成,消滅するオブジェクトではなく,データベース管理システム等により永続的に管理されるオブジェクトである。従来の永続オブジェクトの管理では,例えばRDBMSを直接利用して,オブジェクトのデータをデータベース中に保存することにより,オブジェクトの永続性を実現していた。しかし,従来,任意のオブジェクトのグループ単位でのRDBMSからのデータの取り出しや,RDBMSへのデータの保存を行う手段がなく,また,オブジェクトのグループ単位でのロックやロック解除を行う手段がないため,関連する1オブジェクトごとに取り出しやロック/ロック解除を行う必要があった。
【0003】
【発明が解決しようとする課題】
あるオブジェクトを取り出し更新する場合,すなわち,データベース中に格納されたオブジェクトのデータを取り出し,更新する場合などには,そのオブジェクトと関連するオブジェクトもまとめてデータの取り出し,保存,ロック/ロック解除等を行わないと,オブジェクト間のデータの一貫性を保持することができなくなる。
【0004】
しかし,従来のRDBMSを直接利用する方法では,任意のオブジェクトのグループ単位でのRDBMSのデータの取り出しや保存,オブジェクトのグループ単位でのロック/ロック解除を行う手段がないため,関連オブジェクト間の一貫性を保つことが困難であり,アプリケーション・プログラム等の開発負担が大きく,また,開発されたプログラムのメンテナンスも困難であるという問題があった。
【0005】
本発明は上記問題点の解決を図り,任意のオブジェクトのグループ単位で,RDBMSとのアクセスを可能とする手段を提供することにより,関連オブジェクト間の一貫性を簡単に保つことができるようにすることを目的とする。
【0006】
【課題を解決するための手段】
図1は,本発明の原理説明図である。図中,10はオブジェクト・グループ管理情報生成装置,20はオブジェクト・グループ管理装置,30はリレーショナル・データベース管理システム(RDBMS),40はリレーショナル・データベースを表す。
【0007】
オブジェクト・グループ管理情報生成装置10は,個々のオブジェクトとそれを含むグループとを対応づけ,グループの状態を保持するために必要なデータをRDBMS30内に自動生成する装置である。
【0008】
オブジェクト・グループ管理装置20は,指定されたグループのオブジェクトをまとめてRDBMS30から取り出す手段,あるオブジェクトをRDBMS30から取り出すと同じグループ内のオブジェクトも自動的にまとめてRDBMS30から取り出す手段,オブジェクトのグループにロックをかける手段,オブジェクトのグループにかけたロックを解除する手段,指定されたグループのオブジェクトをまとめてRDBMS30へ保存する手段,あるオブジェクトをRDBMS30へ保存すると同じグループ内のオブジェクトも自動的にまとめてRDBMS30へ保存する手段等を持つ装置である。
【0009】
RDBMS30は,リレーショナル・データベース40を管理し,リレーショナル・データベース40に対する入出力を実行する装置であり,従来用いられているリレーショナル・データベース管理システムと同様のものである。
【0010】
オブジェクト・グループ管理情報生成装置10およびオブジェクト・グループ管理装置20は,例えばオブジェクト指向のソフトウェア(オブジェクト)として,実現することができる。
【0011】
本発明の作用は以下のとおりである。
オブジェクト・グループ管理情報生成装置10は,オブジェクトのグループが指定されると,指定されたオブジェクトとグループの対応関係を示すデータ(グループ構成データ)およびグループの状態を示すデータ(グループ状態データ)をRDBMS30内に自動的に生成する。
【0012】
例えば,アプリケーションの起動時,オブジェクトの更新時,検索時等においてオブジェクトを取り出す場合には,取り出したいオブジェクトのグループを指定すると,オブジェクト・グループ管理装置20は,オブジェクト・グループ管理情報生成装置10が生成したグループ構成データを用いて,グループ内のオブジェクトを全て検索し,それらをまとめてRDBMS30から取り出す。
【0013】
また,取り出したいオブジェクトを指定すると,オブジェクト・グループ管理装置20は,オブジェクト・グループ管理情報生成装置10が生成したグループ構成データを用いて,先ずそのオブジェクトが属するグループを特定し,次にそのグループ内のオブジェクトを全て検索し,まとめてRDBMS30から取り出す。
【0014】
あるグループに対するアクセスをロック/ロック解除したい場合には,オブジェクト・グループ管理装置20は,オブジェクト・グループ管理情報生成装置10が生成したグループ構成データを用いて,そのグループを単位としてロック/ロック解除を行い,オブジェクト・グループ管理情報生成装置10が生成したグループ状態データのロック/ロック解除の状態を書き換え,指定されたオブジェクトのグループがロックされた状態にあるかどうかを示す。あるグループがロックされた状態にある場合には,オブジェクト・グループ管理装置20は,そのグループまたはそのグループに属するオブジェクトに対する更新を受け付けないようにする。
【0015】
保存したいグループを指定すると,オブジェクト・グループ管理装置20は,オブジェクト・グループ管理情報生成装置10が生成したグループ構成データを用いて,グループ内の全オブジェクトをRDBMS30へ保存する。
【0016】
保存したいオブジェクトを指定すると,オブジェクト・グループ管理装置20は,オブジェクト・グループ管理情報生成装置10が生成したグループ構成データを用いて,まずオブジェクトが属するグループを特定し,次にそのグループ内のオブジェクトを全て検索し,まとめてRDBMS30へ保存する。
【0017】
【発明の実施の形態】
図2は,本発明の実施の一形態における構成例を示す図である。
図2中,10はオブジェクト・グループ管理情報生成装置,11はオブジェクト・グループ構成データ登録部,12はオブジェクトID割当て部,13はオブジェクトIDデータ領域生成部,14はグループデータ生成部,20はオブジェクト・グループ管理装置,21はグループ取出し部,22はオブジェクト・グループ取出し部,23はグループ・ロック設定部,24はグループ・ロック解除部,25はグループ更新部,26はグループ・ロック状態チェック部,27はオブジェクト・グループ更新部,30はリレーショナル・データベース管理システム(RDBMS),40はリレーショナル・データベース,50はアプリケーション・プログラムまたは管理用ユーザ・インタフェースを表す。
【0018】
図3は,本実施の形態における管理テーブルの構成例を示す図である。
図3(a)はリレーショナル・データベース40に保存される各オブジェクトに対応するテーブル60,図3(b)はオブジェクトとグループの対応関係を記憶するオブジェクト・グループ構成テーブル61,図3(c)はグループの状態を記憶するグループ状態テーブル62を示す。
【0019】
〔1〕オブジェクトのグループを登録する場合
アプリケーション・プログラムまたは管理用ユーザ・インタフェース50からグループ指定された1つ以上のオブジェクトが入力されると,オブジェクト・グループ構成データ登録部11は,入力されたオブジェクトがIDを持っているかどうかを調べ,IDを持っていない場合には,オブジェクトID割当て部12にそのオブジェクトを入力する。
【0020】
オブジェクトID割当て部12は,入力されたオブジェクトに新たにユニークなID値を割り当て,そのオブジェクトに対応するテーブル60のobject_id列の値を更新する。
【0021】
入力されたオブジェクトのテーブル60にobject_id列がない場合には,オブジェクト・グループ構成データ登録部11は,オブジェクトIDデータ領域生成部13にそのオブジェクト名を入力し,対応するテーブル60にobject_id列を新たに追加する。この処理は,既存プログラムのオブジェクトを流用した場合にも,本発明を利用することができるようにすることを考慮したものである。
【0022】
入力されたオブジェクトにobject_idが割り当てられている場合には,オブジェクト・グループ構成データ登録部11は,グループデータ生成部14にオブジェクトを入力する。
【0023】
グループデータ生成部14は,新しいグループのID値を割り当て,オブジェクト・グループ構成テーブル61にそのグループのIDとそれに属するオブジェクトのIDを持つ新しい行を追加する。また,グループ状態テーブル62に,新しいグループのIDを持つ行を追加する。
【0024】
図3は,3つのオブジェクトが1つのグループとして登録される場合の例を示しており,図3(a)に示す各オブジェクトに対応するテーブル60A,60B,60Cのobject_id列には,それぞれのオブジェクトのID値として,1,2,3が割り当てられている。
【0025】
オブジェクト・グループ構成テーブル61には,図3(b)に示すように,group_id列に新たなグループのID値の1と,object_id列にグループを構成するオブジェクトのID値の1,2,3との組からなる行が追加される。
【0026】
さらに,図3(c)のグループ状態テーブル62には,新たに登録されるグループの状態がstatus列に設定される。このstatus列には,例えばグループ(group_id=1)がロックされた状態である場合にはlocked,ロックされていない状態である場合にはunlockedの旨が設定される。
【0027】
図4は,新しいオブジェクトのグループのデータを生成する処理のフローを示している。
ステップS1では,グループ指定された1つ以上のオブジェクトが入力される。
【0028】
ステップS2では,入力されたオブジェクトを順に調べる。
ステップS3では,入力されたオブジェクトがID値を持つかどうかを判定する。オブジェクトがID値を持つときはステップS7へ進み,ID値を持たないときはステップS4へ進む。
【0029】
ステップS4では,オブジェクトに対応するテーブル60が,object_id列を持つかどうかを判定する。テーブル60がobject_id列を持つときはステップS6へ進み,object_id列を持たないときはステップS5の処理を行う。
【0030】
ステップS5では,オブジェクトに対応するテーブル60にobject_id列を追加する。
ステップS6では,オブジェクトにID値を割り当て,そのオブジェクトに対応する行のobject_id列を,割り当てられたID値で更新する。
【0031】
ステップS7では,グループ指定された全てのオブジェクトについて調べたかどうかを判定し,全てのオブジェクトについて調べたときはステップS8へ進み,全てのオブジェクトについて調べていないときはステップS2の処理へ戻って同様に処理を繰り返す。
【0032】
ステップS8では,新しいグループのID値を割り当てる。
ステップS9では,オブジェクト・グループ構成テーブル61に,グループ指定されたオブジェクト毎に新しい行を追加する。新しい行のgroup_id列には新しいグループのID値を,object_id列には各オブジェクトのID値を格納する。
【0033】
ステップS10では,グループ状態テーブル62に,group_idが新しいグループのID値である新しい行を追加する。
〔2〕グループを指定して全てのオブジェクトを取り出す場合
アプリケーション・プログラムまたは管理用ユーザ・インタフェース50から,取り出すグループのグループIDがグループ取出し部21に入力される。
【0034】
グループ取出し部21は,オブジェクト・グループ構成テーブル61を検索し,入力されたグループIDに対応するオブジェクトのIDを得る。次に,オブジェクトに対応する全てのテーブル60を検索し,オブジェクトのIDに一致する行を得て,この行のデータからオブジェクトを生成する。
【0035】
図5は,グループを指定してオブジェクトをまとめて取り出す処理のフローを示している。
ステップS11では,グループ取出し部21にグループのID値が入力される。
【0036】
ステップS12では,グループ取出し部21は,オブジェクト・グループ構成テーブル61を検索し,group_idの値が入力されたID値と一致する行からオブジェクトのIDを得る。
【0037】
ステップS13では,ステップS12の処理で得たオブジェクトのIDで,各オブジェクトに対応する全てのテーブル60を検索する。
ステップS14では,検索の結果得られた行のデータからオブジェクトを生成する。
【0038】
〔3〕あるオブジェクトを指定して,そのオブジェクトが属するグループ全てのオブジェクトを取り出す場合
取り出すオブジェクトのID値が,アプリケーション・プログラムまたは管理用ユーザ・インタフェース50からオブジェクト・グループ取出し部22に入力される。
【0039】
オブジェクト・グループ取出し部22は,オブジェクト・グループ構成テーブル61を検索し,オブジェクトのIDと対応するグループのIDを得て,この値をグループ取出し部21に入力する。以降は,前項〔2〕において説明した処理と同様である。
【0040】
図6は,あるオブジェクトを指定して,そのオブジェクトが属するグループの全てのオブジェクトを取り出す処理のフローを示している。
ステップS15では,オブジェクト・グループ取出し部22にオブジェクトのID値が入力される。
【0041】
ステップS16では,オブジェクト・グループ取出し部22は,オブジェクト・グループ構成テーブル61を検索し,object_idの値が,入力されたID値と一致する行からグループのIDを得る。
【0042】
ステップS17では,ステップS16の処理で得たグループIDをグループ取出し部21に入力する。以降,グループ取出し部21により,図5に示すステップS11〜S14の処理が行われる。
【0043】
〔4〕グループにロック設定/ロック解除の処理の場合
以下では,説明を簡単にするために,ロックの種類はアクセス禁止の1種類として説明するが,グループに対するロックとして,例えば書き換え禁止や,読み出し禁止等の複数のレベルのロックを行ってもよい。
【0044】
アプリケーション・プログラムまたは管理用ユーザ・インタフェース50から,ロックをかけたいグループのIDが,グループ・ロック設定部23に入力される。グループ・ロック設定部23は,グループ状態テーブル62のグループIDに対する行のstatus列のデータをlocked(ロック状態)に書き換える。
【0045】
図7は,グループにロックをかける処理のフローを示している。
ステップS21では,グループ・ロック設定部23にグループのID値が入力される。
【0046】
ステップS22では,グループ状態テーブル62を検索し,group_idの値が入力されたID値と一致する行のstatus列の値をlocked(ロック状態)に書き換える。
【0047】
反対にグループのロックを解除する場合には,アプリケーション・プログラムまたは管理用ユーザ・インタフェース50からロックを解除したいグループのIDが,グループ・ロック解除部24に入力される。グループ・ロック解除部24は,グループ状態テーブル62のグループIDに対する行のstatus列の値をロック解除状態に書き換える。
【0048】
図8は,グループのロックを解除する処理のフローを示している。
ステップS23では,グループ・ロック解除部24にグループのID値が入力される。
【0049】
ステップS24では,グループ状態テーブル62を検索し,group_idの値が入力されたID値と一致する行のstatus列の値をロック解除状態に書き換える。
【0050】
〔5〕グループを指定してオブジェクトをまとめて更新する場合
アプリケーション・プログラムまたは管理用ユーザ・インタフェース50から,更新するグループのIDがグループ更新部25に入力される。
【0051】
グループ更新部25は,グループ・ロック状態チェック部26にグループIDを入力する。
グループ・ロック状態チェック部26は,グループ状態テーブル62を検索し,入力されたグループIDに対応するstatus列の値がロック状態であれば,更新できない旨のメッセージを出して処理を終了する。ここで,入力されたグループIDに対応するstatus列の値がロック状態でなければ,オブジェクト・グループ構成テーブル61を検索し,入力されたグループIDに対応するオブジェクトのIDを得る。次に,このオブジェクトIDに対応する全ての行のデータをまとめて更新する。
【0052】
図9は,グループを指定してオブジェクトをまとめて更新する処理のフローを示している。
ステップS31では,グループ更新部25に,更新対象とするグループのID値が入力される。
【0053】
ステップS32では,グループ状態テーブル62を検索し,グループがロック状態であるかどうかを調べる。
ステップS33では,グループがロック状態であるかどうかの判定を行い,ロック状態であればステップS36の処理を行い,ロック状態でなければステップS34へ進む。
【0054】
ステップS34では,オブジェクト・グループ構成テーブル61を検索し,group_idの値が入力されたID値と一致する行からオブジェクトのIDを得る。
【0055】
ステップS35では,ステップS34で得たオブジェクトのIDに対応する全ての行のデータを更新する。
ステップS36では,更新できない旨のメッセージを出す。
【0056】
〔6〕あるオブジェクトを指定して,そのオブジェクトが属するグループの全てのオブジェクトをまとめて更新する場合
アプリケーション・プログラムまたは管理用ユーザ・インタフェース50から,更新するグループに属するオブジェクトのIDがオブジェクト・グループ更新部27に入力される。
【0057】
オブジェクト・グループ更新部27は,オブジェクト・グループ構成テーブル61を検索し,オブジェクトのIDと対応するグループのIDを得る。この値をグループ更新部25に入力する。以降の処理は,前項〔5〕において説明した処理と同様である。
【0058】
図10は,あるオブジェクトを指定して,そのオブジェクトが属するグループの全てのオブジェクトを更新する処理のフローを示している。
ステップS41では,オブジェクト・グループ更新部27にオブジェクトのID値が入力される。
【0059】
ステップS42では,オブジェクト・グループ構成テーブル61を検索し,object_idの値が入力されたID値と一致する行からグループのIDを得る。
【0060】
ステップS43では,グループIDがあるかどうかを判定する。グループIDがあるときはステップS44の処理を行い,グループIDがないときはステップS45の処理を行う。
【0061】
ステップS44では,グループIDをグループ更新部25に入力する。以降は図9に示す処理が行われる。
ステップS45では,指定されたIDのオブジェクトのみを更新する。
【0062】
【実施例】
次に,本発明の一実施例として,宿泊予約業務プログラムを,オブジェクト指向ソフトウェアで実現した場合の例を説明する。
【0063】
図11は,実施例におけるオブジェクト指向ソフトウェア言語で表わした各処理部の構成例を示している。
図2に示すオブジェクト・グループ管理情報生成装置10は,オブジェクト・グループ管理情報生成オブジェクト〔オブジェクト名:OGGenerator(図中,OGGnrと表す)〕110により実現され,オブジェクト・グループ管理装置20は,オブジェクト・グループ管理オブジェクト〔オブジェクト名:OGManager(図中,OGMngと表す)〕120により実現される。
【0064】
図2に示すオブジェクト・グループ管理情報生成装置10の持つ各手段は,OGGenerator110のオブジェクト・グループ構成データ登録部〔int OGGenerator::enter(PObjGroup *pog)〕111,オブジェクトID割当て部〔int OGGenerator::assign_oid()〕112,グループデータ生成部〔int OGGenerator::create_group(PObjGroup *pog)〕113,グループID割当て部〔int OGGenetator::assign_gid()〕114により実現される。
【0065】
同様に,図2のオブジェクト・グループ管理装置20の持つ各手段は,OGManager120のグループ取出し部〔PObjGroup* OGManager::retrieve_group(int gid)〕121,オブジェクト・グループ取出し部〔PObj* OGManager::retrive_og(int oid)〕122,グループ・ロック設定部〔int OGManager::lock_group(int gid,int status)〕123,グループ・ロック解除部〔void OGManager::unlock_group(int gid,int key)〕124,グループ更新部〔void OGManager::update_group(PObjGroup *pog,int key)〕125,グループ・ロック状態チェック部〔int OGManager::check_lock_status(int gid,int key)〕126,オブジェクト・グループ更新部〔void OGManager:update_og(Pobj *og,int key)〕127,オブジェクト生成指示部〔PObj* OGManager::load_obj(int oid,int cid)〕128により実現される。
【0066】
ここで,例えばオブジェクト・グループ構成データ登録部111の〔intOGGenerator::enter(PObjGroup *pog)〕におけるenterは操作名を表し,「int」は返す値の型を,「OGGenerator::」は,この操作名が属するオブジェクト・クラスを,「(PObjGroup *pog)」は,enterの操作の引数が,クラスPObjGroupの変数名*pog(*はポインタ型の変数)であることを表す。他の操作についても同様な表記である。これらの表記は,オブジェクト指向言語として周知のC++言語等により知られている表記と同様であるので,これ以上の詳細な説明は省略する。
【0067】
図12は,実施例における,アプリケーションプログラム150の永続オブジェクトグループクラス(PObjGroup)151,永続オブジェクトクラス(PObj)152,永続オブジェクト・データ格納クラス(PObjDS)153の内容の例を示す図である。
【0068】
永続オブジェクトグループクラス(PObjGroup)151において,$pseudo_gid_counter:int,group_id:int,state:int,key:intは属性名であり,$find(gid:int):PObjGroup,enter(),store(),lock(),write(),fix_gid(gid:int),get_pobjs():Set*,get_po(oid:int):PObj,revive_links()は操作名である。
【0069】
また,永続オブジェクトクラス(PObj)152において,$class_id:int,object_id:int,group_id:int,can_I_lock:int,state:intは属性名であり,$create(),store_group(),lock_group(),store_me(),set_all_linkid(),get_pog():PObjGroup*,get_key():intは操作名である。
【0070】
永続オブジェクト・データ格納クラス(PObjDS)153において,$table_name:char*,$primary_key:char*は属性名であり,$instance():PObjDS*,load(oid:int):PObj*,insert(po:PObj*),update(po:PObj*),delete(po:PObj*)は操作名である。
【0071】
永続オブジェクトグループクラス(PObjGroup)151と永続オブジェクトクラス(PObj)152とは,「has_a」の関係(図中,◇で示す)にある。すなわち,永続オブジェクトグループクラス(PObjGroup)151が,0個以上(図中,*で示す)の永続オブジェクトクラス(PObj)152と関係を持つことを意味する。
【0072】
図13は,実施例におけるアプリケーションのクラス定義の例を,OMT(Unified_Method)表記法により示す図である。
図13(a)に示すように,永続オブジェクトクラス(PObj)152のサブクラスとして,「顧客」,「宿泊予約」,「宿泊予約明細」,「客室予約」,「客室タイプ」の各クラスが存在する。ここで,「顧客」からみて「宿泊予約」は1つであり(図中,1で示す),「宿泊予約」からみて「顧客」は0個以上ある(図中,*で示す)という関係にある。また,「宿泊予約」からみて,「宿泊予約」が持つ「宿泊予約明細」は1以上あり(図中,1..で示す),「宿泊予約明細」からみると「客室予約」も1以上あるという関係にある。
【0073】
また,図13(b)に示すように,永続オブジェクト・データ格納クラス(PObjDS)153のサブクラスとして,「顧客DS」,「宿泊予約DS」,「宿泊予約明細DS」,「客室予約DS」,「客室タイプDS」の各クラスが存在する。
【0074】
図14は,宿泊予約業務アプリケーションで,実際に生成されるオブジェクトの例を示す図である。
図14中に示す,顧客オブジェクト,宿泊予約オブジェクト,宿泊予約明細オブジェクト,客室予約オブジェクト,客室タイプオブジェクトは,宿泊予約業務プログラムに用いるために,RDBMSから同時に取り出す1のグループを構成する。顧客オブジェクト,宿泊予約オブジェクト,宿泊予約明細オブジェクト,客室予約オブジェクトは,更新の際にデータの一貫性を保持する必要があるため,ロックをかけるオブジェクトである。
【0075】
図15および図16は,実施例における管理テーブルの例を示す図である。図15(a)は,オブジェクト・グループ構成テーブル161,図15(b)はグループ状態テーブル162,図15(c)はリンクテーブル163の例を示している。これらのテーブルにより,オブジェクトのグループ構成とグループの状態についてのデータを保持する。図16は,各オブジェクトに対応するテーブル170〜174の例であって,図16(a)は顧客オブジェクトのテーブル170,図16(b)は宿泊予約オブジェクトのテーブル171,図16(c)は宿泊予約明細オブジェクトのテーブル172,図16(d)は客室予約オブジェクトのテーブル173,図16(e)は客室タイプオブジェクトのテーブル174である。
【0076】
図17〜図23は,実施例における動作のフローを示す図である。
図17は,新しいオブジェクトのグループのデータを生成する場合の動作のフローを示す図である。
【0077】
図11に示すオブジェクト・グループ管理情報生成オブジェクトOGGenerator110に,グループを指定するポインタpogを引数とする操作enterの指示が送られ,これによってオブジェクト・グループ構成データ登録部111が動作し,Customer(顧客),Reservation(宿泊予約),Rsv_for_night(宿泊予約明細),Rsv_for_room(客室予約),Room_type(客室予約)のオブジェクトが入力される(ステップS51)。
【0078】
オブジェクト・グループ構成データ登録部111は,入力されたこれらのオブジェクトを順に調べ(ステップS52),各オブジェクトがID値を持つかどうかを判定する(ステップS53)。ここで,オブジェクトがID値を持っていないときは,「int OGGenerator::assign_oid()」の指示により,オブジェクトID割当て部112が起動され,オブジェクトにID値が割り当てられる(ステップS54)。
【0079】
各オブジェクトに対して同様に処理した後(ステップS55),「int OGGenerator::assign_gid()」の指示により,グループID割当て部114を動作させ,新しいグループのID値を割り当てる(ステップS56)。
【0080】
次に,「int OGGenerator::create_group(PObjGroup *pog)」の指示により,グループデータ生成部113を動作させ,オブジェクト・グループ構成テーブル161に新しいグループのID値を各オブジェクトのID値と組み合わせて格納する(ステップS57)。また,グループ状態テーブル162に,新しいグループのID値である新しい行を追加する(ステップS58)。
【0081】
図18は,グループを指定してオブジェクトをまとめて取り出す場合の動作のフローを示す図である。
図11に示すオブジェクト・グループ管理オブジェクトOGManager120に,グループのID値を引数とする操作retrieve_groupの指示が送られ,これによってグループ取出し部121が動作する(ステップS61)。
【0082】
グループ取出し部121は,オブジェクト・グループ構成テーブル161を検索して,group_idの値が入力されたID値と一致する行から,オブジェクトのID(object_id)とクラスID(class_id)とを得る(ステップS62)。また,オブジェクト・グループ構成テーブル161とグループ状態テーブル162とを参照し,抽出した行のlockの値を調べる(ステップS63,ステップS64)。
【0083】
他のグループにも属しているlockがyesのオブジェクトで,readlockされているものがあれば,オブジェクトを取り出せない旨のメッセージを出し(ステップS67),処理を終了する。
【0084】
lockがかけられていなければ,「PObj* OGManager::load_obj(int oid,int cid)」の指示により,オブジェクト生成指示部128を動作させ,オブジェクト・グループ構成テーブル161のclass_idからそのオブジェクトを処理する責任を持つオブジェクトを特定して,そのオブジェクトに対し,object_idに対応するオブジェクトを生成するよう要求する(ステップS65)。
【0085】
これによって,「PObj* PObjDS::load(int oid,int cid)」の指示が出され,オブジェクト生成部(図示省略)が動作し,オブジェクト生成部は,オブジェクトのID(object_id)を用いて,RDBMS130からオブジェクトの生成に必要なデータを取り出して,オブジェクトを生成する(ステップS66)。
【0086】
図19は,あるオブジェクトを指定して,そのオブジェクトが属するグループの全てのオブジェクトを取り出す場合の動作のフローを示す図である。
「PObj* OGManager::retrieve_og(int oid)」の指示により,オブジェクト・グループ管理オブジェクト120のオブジェクト・グループ取出し部122に,オブジェクトのID値が入力される(ステップS68)。オブジェクト・グループ取出し部122は,オブジェクト・グループ構成テーブル161を検索し,入力されたID値と一致する行からグループのIDを得る(ステップS69)。
【0087】
次に,「PObjGroup* OGManager::retrieve_group(int gid)」の指示により,グループ取出し部121を呼び出し,グループ取出し部121にグループIDを入力する(ステップS70)。これにより,指定されたオブジェクトと同じグループの全オブジェクトが取り出されることになる。
【0088】
図20は,グループにロックをかける場合の動作のフローを示す図である。
「int OGManager::lock_group(int gid,int status)」の指示により,グループ・ロック設定部123が動作し,グループのID値と,ロックの種類(read/write)が入力される(ステップS71)。
【0089】
グループ・ロック設定部123は,グループ状態テーブル162を検索して,group_id列の値が入力されたID値と一致する行のstatus列の値を,入力されたロックの種類に書き換える(ステップS72)。次にロックをかけたデータを更新したり,ロックを解除したりするためのキーとなる値を,グループに渡す(ステップS73)。
【0090】
図21はグループのロックを解除する場合の動作のフローを示す図である。
「void OGManager::unlock_group(int gid,int key)」の指示により,グループ・ロック解除部124が動作し,グループのID値とロック設定時に割り当てられたキーが入力される(ステップS74)。グループ・ロック解除部124は,グループ状態テーブル162を検索し,テーブル内のkey列の値と入力されたキーの値が一致し,またgroup_idの値が入力されたID値と一致する行のstatus列の値をロック解除状態に書き換える(ステップS75〜S77)。キーの値が一致しない場合,ロックが解除できない旨のメッセージを出す(ステップS78)。
【0091】
図22は,グループを指定してオブジェクトをまとめて更新する場合の動作のフローを示す図である。
「void OGManager::update_group(PObjGroup *pog,int key)」の指示により,グループ更新部125が動作し,更新したいグループが入力される(S81)。次に,「int OGManager::check_lock_status(int gid,int key)」の指示により,グループ・ロック状態チェック部126を呼び出し,グループが更新可能かどうかを調べる(ステップS82,S83)。
【0092】
更新可能であれば,オブジェクト・グループ構成テーブル161を検索し,group_idの値が入力されたID値と一致する行で,かつlockがyesになっている行オブジェクトのIDとクラスのIDを得る(ステップS84)。そして,そのオブジェクトIDに対応するオブジェクトに対し,データを格納するように指示する(ステップS85)。「void PObj::store_me()」の指示によって,オブジェクトのIDに対応するデータが更新される(ステップS86)。更新しようとするグループがロック状態のため,更新できない場合には,更新できない旨のメッセージを出力し,処理を終了する(ステップS87)。
【0093】
図23は,あるオブジェクトを指定して,そのオブジェクトが属するグループの全てのオブジェクトを更新する場合の動作のフローを示す図である。
「void OGManager::update_og(PObj *og,int key)」の指示により,オブジェクト・グループ更新部127が動作し,更新したいオブジェクトが入力される(ステップS91)。オブジェクト・グループ更新部127は,入力されたオブジェクトからそのオブジェクトが属するグループ(オブジェクト)を得る(ステップS92)。次に,「voidOGManager::update_group(PObjGroup *pog,int key)」の指示により,グループをグループ更新部125に入力し,グループをまとめて更新する(ステップS93)。
【0094】
【発明の効果】
あるオブジェクトを更新する場合,それと関連するオブジェクトもまとめてデータの取り出し,保存,ロック/ロック解除等を行わないと,オブジェクト間のデータの一貫性が保持できなくなる。
【0095】
本発明によれば,任意のオブジェクトのグループ単位でRDBMSのデータの取り出し,保存,ロック/ロック解除等を行うことにより,関連するオブジェクト間のデータの一貫性を保持することができるようになる。特に,種々のオブジェクト指向言語プロセッサに対して,外付けの機能として本発明の機構を付加することができるため,リレーショナル・データベース管理システムを用いる既存のオブジェクト指向言語に対しても本発明を容易に適用することが可能であるという効果がある。
【図面の簡単な説明】
【図1】本発明の原理説明図である。
【図2】実施の一形態における構成例を示す図である。
【図3】管理テーブルの構成例を示す図である。
【図4】グループのデータを生成する処理のフローを示す図である。
【図5】グループを指定してオブジェクトをまとめて取り出す処理のフローを示す図である。
【図6】あるオブジェクトを指定して,そのオブジェクトが属するグループの全てのオブジェクトを取り出す処理のフローを示す図である。
【図7】グループにロックをかける処理のフローを示す図である。
【図8】グループのロックを解除する処理のフローを示す図である。
【図9】グループを指定してオブジェクトをまとめて更新する処理のフローを示す図である。
【図10】あるオブジェクトを指定して,そのオブジェクトが属するグループの全てのオブジェクトを更新する処理のフローを示す図である。
【図11】本発明の実施例の構成を示す図である。
【図12】実施例における永続オブジェクトの例を示す図である。
【図13】実施例におけるアプリケーションのクラス定義の例を示す図である。
【図14】実施例におけるオブジェクトの例を示す図である。
【図15】実施例におけるテーブルの例を示す図である。
【図16】実施例におけるテーブルの例を示す図である。
【図17】グループのデータを生成する場合の動作のフローを示す図である。
【図18】グループを指定してオブジェクトをまとめて取り出す場合の動作のフローを示す図である。
【図19】あるオブジェクトを指定して,そのオブジェクトが属するグループの全てのオブジェクトを取り出す場合の動作のフローを示す図である。
【図20】グループにロックをかける場合の動作のフローを示す図である。
【図21】グループのロックを解除する場合の動作のフローを示す図である。
【図22】グループを指定してオブジェクトをまとめて更新する場合の動作のフローを示す図である。
【図23】あるオブジェクトを指定して,そのオブジェクトが属するグループの全てのオブジェクトを更新する場合の動作のフローを示す図である。
【符号の説明】
10 オブジェクト・グループ管理情報生成装置
20 オブジェクト・グループ管理装置
30 リレーショナル・データベース管理システム(RDBMS)
40 リレーショナル・データベース
[0001]
BACKGROUND OF THE INVENTION
In the object-oriented software, when the object persistence is realized by a relational database management system (hereinafter referred to as RDBMS), the present invention accesses (retrieves, stores, locks) the RDBMS in units of object groups. , Lock release, etc.), thereby enabling consistency between related persistent objects to be maintained.
[0002]
[Prior art]
A persistent object is not an object that is temporarily created or destroyed, but an object that is permanently managed by a database management system or the like. In conventional persistent object management, for example, RDBMS is directly used to store object data in a database to realize object persistence. However, conventionally, there is no means for fetching data from an RDBMS in an arbitrary object group unit, or storing data in the RDBMS, and there is no means for locking or unlocking an object group unit. Therefore, it is necessary to take out and lock / unlock each related object.
[0003]
[Problems to be solved by the invention]
When an object is retrieved and updated, that is, when data of an object stored in the database is retrieved and updated, the objects associated with the object are also retrieved, stored, locked / unlocked, etc. Otherwise, data consistency among objects cannot be maintained.
[0004]
However, in the conventional method of directly using RDBMS, there is no means for fetching and storing RDBMS data in groups of arbitrary objects, and locking / unlocking of objects in groups. It is difficult to maintain the performance, the burden of development of application programs, etc. is large, and maintenance of the developed program is difficult.
[0005]
The present invention solves the above-described problems and provides a means for enabling access to the RDBMS in units of arbitrary object groups so that consistency between related objects can be easily maintained. For the purpose.
[0006]
[Means for Solving the Problems]
FIG. 1 is an explanatory diagram of the principle of the present invention. In the figure, 10 is an object group management information generating device, 20 is an object group management device, 30 is a relational database management system (RDBMS), and 40 is a relational database.
[0007]
The object / group management information generating apparatus 10 is an apparatus that associates each object with a group including the object and automatically generates data necessary for maintaining the state of the group in the RDBMS 30.
[0008]
The object group management device 20 is a means for collectively retrieving objects from a specified group from the RDBMS 30, a means for automatically retrieving objects within the same group from the RDBMS 30 and locking them to the group of objects. , Means for releasing the lock applied to the group of objects, means for collectively storing the objects of the specified group in the RDBMS 30, and saving an object in the RDBMS 30 automatically collects the objects in the same group to the RDBMS 30 It is a device having means for storing.
[0009]
The RDBMS 30 is a device that manages the relational database 40 and executes input / output with respect to the relational database 40, and is similar to a conventionally used relational database management system.
[0010]
The object group management information generation device 10 and the object group management device 20 can be realized as, for example, object-oriented software (object).
[0011]
The operation of the present invention is as follows.
When an object group is specified, the object group management information generation apparatus 10 receives data (group configuration data) indicating the correspondence between the specified object and the group and data (group status data) indicating the group status (RDBMS 30). Generate automatically within.
[0012]
For example, when an object is extracted at the time of starting an application, at the time of updating an object, at the time of searching, etc., the object group management device 20 is generated by the object group management information generation device 10 when a group of objects to be extracted is designated. Using the group configuration data thus obtained, all objects in the group are searched, and they are collectively extracted from the RDBMS 30.
[0013]
When an object to be extracted is designated, the object group management device 20 first identifies the group to which the object belongs using the group configuration data generated by the object group management information generation device 10, and then identifies the object within the group. Are retrieved from the RDBMS 30 together.
[0014]
When it is desired to lock / unlock access to a group, the object group management device 20 uses the group configuration data generated by the object group management information generation device 10 to lock / unlock the group as a unit. Then, the lock / unlock state of the group state data generated by the object group management information generation device 10 is rewritten to indicate whether the specified group of objects is in a locked state. When a certain group is in a locked state, the object group management device 20 does not accept an update for the group or an object belonging to the group.
[0015]
When a group to be stored is designated, the object group management apparatus 20 stores all objects in the group in the RDBMS 30 using the group configuration data generated by the object group management information generation apparatus 10.
[0016]
When the object to be stored is designated, the object group management device 20 first identifies the group to which the object belongs using the group configuration data generated by the object group management information generation device 10, and then selects the object in the group. All of them are searched and collectively stored in the RDBMS 30.
[0017]
DETAILED DESCRIPTION OF THE INVENTION
FIG. 2 is a diagram showing a configuration example in an embodiment of the present invention.
In FIG. 2, 10 is an object / group management information generating device, 11 is an object / group configuration data registering unit, 12 is an object ID assigning unit, 13 is an object ID data area generating unit, 14 is a group data generating unit, and 20 is an object. A group management device, 21 is a group extraction unit, 22 is an object group extraction unit, 23 is a group lock setting unit, 24 is a group lock release unit, 25 is a group update unit, 26 is a group lock state check unit, Reference numeral 27 denotes an object group update unit, 30 denotes a relational database management system (RDBMS), 40 denotes a relational database, and 50 denotes an application program or a management user interface.
[0018]
FIG. 3 is a diagram showing a configuration example of the management table in the present embodiment.
3A is a table 60 corresponding to each object stored in the relational database 40, FIG. 3B is an object group configuration table 61 that stores the correspondence between objects and groups, and FIG. The group state table 62 which memorize | stores the state of a group is shown.
[0019]
[1] When registering a group of objects
When one or more objects specified as a group are input from the application program or the management user interface 50, the object group configuration data registration unit 11 checks whether or not the input object has an ID. If the user does not have an ID, the object is input to the object ID assigning unit 12.
[0020]
The object ID assigning unit 12 assigns a new unique ID value to the input object, and updates the value of the object_id column of the table 60 corresponding to the object.
[0021]
When there is no object_id column in the input object table 60, the object group configuration data registration unit 11 inputs the object name into the object ID data area generation unit 13 and newly adds the object_id column to the corresponding table 60. Add to This processing takes into consideration that the present invention can be used even when an object of an existing program is used.
[0022]
If object_id is assigned to the input object, the object / group configuration data registration unit 11 inputs the object to the group data generation unit 14.
[0023]
The group data generation unit 14 assigns a new group ID value and adds a new row having the ID of the group and the ID of the object belonging to the group to the object group configuration table 61. In addition, a row having a new group ID is added to the group status table 62.
[0024]
FIG. 3 shows an example in which three objects are registered as one group. The object_id column of the tables 60A, 60B, and 60C corresponding to each object shown in FIG. 1, 2, and 3 are assigned as ID values.
[0025]
In the object group configuration table 61, as shown in FIG. 3B, the ID value of the new group is 1 in the group_id column, and the ID values 1, 2, 3 of the objects constituting the group are displayed in the object_id column. A line consisting of
[0026]
Further, in the group status table 62 in FIG. 3C, the status of the newly registered group is set in the status column. In this status column, for example, “locked” is set when the group (group_id = 1) is locked, and “unlocked” is set when the group is not locked.
[0027]
FIG. 4 shows a flow of processing for generating data of a new object group.
In step S1, one or more objects designated as a group are input.
[0028]
In step S2, the input objects are examined in order.
In step S3, it is determined whether the input object has an ID value. If the object has an ID value, the process proceeds to step S7. If the object does not have an ID value, the process proceeds to step S4.
[0029]
In step S4, it is determined whether or not the table 60 corresponding to the object has an object_id column. When the table 60 has the object_id column, the process proceeds to step S6. When the table 60 does not have the object_id column, the process of step S5 is performed.
[0030]
In step S5, an object_id column is added to the table 60 corresponding to the object.
In step S6, an ID value is assigned to the object, and the object_id column of the row corresponding to the object is updated with the assigned ID value.
[0031]
In step S7, it is determined whether or not all the objects designated by the group have been examined. When all the objects have been examined, the process proceeds to step S8. When all the objects have not been examined, the process returns to step S2 and similarly. Repeat the process.
[0032]
In step S8, a new group ID value is assigned.
In step S9, a new line is added to the object group configuration table 61 for each group-designated object. The ID value of the new group is stored in the group_id column of the new row, and the ID value of each object is stored in the object_id column.
[0033]
In step S10, a new row in which group_id is the ID value of the new group is added to the group status table 62.
[2] When retrieving all objects by specifying a group
The group ID of the group to be extracted is input to the group extraction unit 21 from the application program or the management user interface 50.
[0034]
The group extraction unit 21 searches the object group configuration table 61 and obtains the ID of the object corresponding to the input group ID. Next, all the tables 60 corresponding to the object are searched, a line matching the object ID is obtained, and the object is generated from the data of this line.
[0035]
FIG. 5 shows a flow of processing for extracting objects collectively by specifying a group.
In step S <b> 11, the group ID value is input to the group extraction unit 21.
[0036]
In step S12, the group extraction unit 21 searches the object group configuration table 61, and obtains the object ID from the line where the value of group_id matches the input ID value.
[0037]
In step S13, all the tables 60 corresponding to each object are searched with the object ID obtained in the process of step S12.
In step S14, an object is generated from the row data obtained as a result of the search.
[0038]
[3] When a certain object is specified and all the objects to which the object belongs are extracted
The ID value of the object to be extracted is input to the object group extraction unit 22 from the application program or the management user interface 50.
[0039]
The object group extraction unit 22 searches the object group configuration table 61 to obtain the group ID corresponding to the object ID, and inputs this value to the group extraction unit 21. The subsequent processing is the same as the processing described in [2].
[0040]
FIG. 6 shows a flow of processing for designating a certain object and extracting all objects in the group to which the object belongs.
In step S 15, the object ID value is input to the object group extraction unit 22.
[0041]
In step S16, the object group retrieval unit 22 searches the object group configuration table 61, and obtains the group ID from the line where the value of object_id matches the input ID value.
[0042]
In step S17, the group ID obtained in step S16 is input to the group extraction unit 21. Thereafter, the group take-out unit 21 performs steps S11 to S14 shown in FIG.
[0043]
[4] Group lock / unlock processing
In the following, for simplicity of explanation, the type of lock is described as one type of access prohibition, but as a lock for a group, for example, multiple levels of lock such as rewrite prohibition and read prohibition may be performed.
[0044]
The ID of the group to be locked is input to the group lock setting unit 23 from the application program or the management user interface 50. The group lock setting unit 23 rewrites the data in the status column of the row corresponding to the group ID in the group state table 62 to locked (locked state).
[0045]
FIG. 7 shows a flow of processing for locking a group.
In step S 21, the group ID value is input to the group lock setting unit 23.
[0046]
In step S22, the group state table 62 is searched, and the value of the status column in the row whose group_id value matches the input ID value is rewritten to locked (locked state).
[0047]
On the other hand, when the group lock is released, the ID of the group to be unlocked is input to the group lock release unit 24 from the application program or the management user interface 50. The group lock release unit 24 rewrites the value of the status column of the row corresponding to the group ID in the group state table 62 to the unlock state.
[0048]
FIG. 8 shows a flow of processing for releasing the group lock.
In step S 23, the group ID value is input to the group lock release unit 24.
[0049]
In step S24, the group state table 62 is searched, and the value of the status column in the row where the value of group_id matches the input ID value is rewritten to the unlocked state.
[0050]
[5] When updating a group of objects by specifying a group
The ID of the group to be updated is input to the group update unit 25 from the application program or the management user interface 50.
[0051]
The group update unit 25 inputs the group ID to the group lock state check unit 26.
The group lock state check unit 26 searches the group state table 62, and if the value in the status column corresponding to the input group ID is in the locked state, issues a message indicating that the update cannot be performed and ends the process. Here, if the value in the status column corresponding to the input group ID is not locked, the object group configuration table 61 is searched to obtain the ID of the object corresponding to the input group ID. Next, the data of all the rows corresponding to this object ID are updated together.
[0052]
FIG. 9 shows a flow of processing for updating a group of objects by specifying a group.
In step S31, the ID value of the group to be updated is input to the group update unit 25.
[0053]
In step S32, the group status table 62 is searched to check whether the group is locked.
In step S33, it is determined whether or not the group is in the locked state. If the group is in the locked state, the process of step S36 is performed. If not in the locked state, the process proceeds to step S34.
[0054]
In step S34, the object group configuration table 61 is searched, and the ID of the object is obtained from the line where the value of group_id matches the input ID value.
[0055]
In step S35, data in all rows corresponding to the object ID obtained in step S34 is updated.
In step S36, a message indicating that updating is not possible is issued.
[0056]
[6] When an object is specified and all objects in the group to which the object belongs are updated together
An ID of an object belonging to the group to be updated is input to the object group updating unit 27 from the application program or the management user interface 50.
[0057]
The object group updating unit 27 searches the object group configuration table 61 to obtain the group ID corresponding to the object ID. This value is input to the group update unit 25. The subsequent processing is the same as the processing described in [5] above.
[0058]
FIG. 10 shows a flow of processing for designating a certain object and updating all the objects in the group to which the object belongs.
In step S 41, the object ID value is input to the object group update unit 27.
[0059]
In step S42, the object group configuration table 61 is searched, and the ID of the group is obtained from the row where the value of object_id matches the input ID value.
[0060]
In step S43, it is determined whether there is a group ID. When there is a group ID, the process of step S44 is performed, and when there is no group ID, the process of step S45 is performed.
[0061]
In step S44, the group ID is input to the group update unit 25. Thereafter, the processing shown in FIG. 9 is performed.
In step S45, only the object with the specified ID is updated.
[0062]
【Example】
Next, as an embodiment of the present invention, an example in which the accommodation reservation business program is realized by object-oriented software will be described.
[0063]
FIG. 11 shows a configuration example of each processing unit expressed in the object-oriented software language in the embodiment.
The object group management information generation apparatus 10 shown in FIG. 2 is realized by an object group management information generation object [object name: OGGenerator (denoted as OGGnr in the figure)] 110. The object group management information generation apparatus 20 This is realized by a group management object [object name: OGMManager (denoted as OGMng in the figure)] 120.
[0064]
Each means of the object group management information generation apparatus 10 shown in FIG. 2 includes an object group configuration data registration unit [int OG Generator :: enter (PObjGroup * pog)] 111 of the OG Generator 110, and an object ID allocation unit [int OG Generator :: assign_oid ()] 112, a group data generation unit [int OGGenerator :: create_group (PObjGroup * pog)] 113, and a group ID assignment unit [int OGGenerator :: assign_gid ()] 114.
[0065]
Similarly, each means of the object group management apparatus 20 of FIG. 2 includes an OGManager 120 group fetching unit [PObjGroup * OGManager :: retrieve_group (int gid)] 121, an object group fetching unit [PObj * OGManager :: retrieve_og ( int oid)] 122, group lock setting unit [int OGManager :: lock_group (int gid, int status)] 123, group lock release unit [void OGManager :: unlock_group (int gid, int key)] 124, group update Part [void OGManager :: update_group (PObjGroup * pog, int k ey)] 125, group lock state check unit [int OGManager :: check_lock_status (int gid, int key)] 126, object group update unit [void OGManager: update_og (Pobj * og, int key)] 127, object generation The instruction unit [PObj * OGManager :: load_obj (int oid, int cid)] 128 is implemented.
[0066]
Here, for example, “enter” in [intOGGenerator :: enter (PObjGroup * pog)] of the object group configuration data registration unit 111 represents an operation name, “int” represents the type of value to be returned, and “OGGenerator ::” The object class to which the operation name belongs, “(PObjGroup * pog)” indicates that the argument of the operation of enter is the variable name * pog (* is a pointer type variable) of the class PObjGroup. The same notation is used for other operations. These notations are the same as notations known by C ++ language or the like well-known as an object-oriented language, and thus detailed description thereof is omitted.
[0067]
FIG. 12 is a diagram illustrating examples of the contents of the persistent object group class (PObjGroup) 151, the persistent object class (PObj) 152, and the persistent object data storage class (PObjDS) 153 of the application program 150 in the embodiment.
[0068]
In the persistent object group class (PObjGroup) 151, $ pseudo_gid_counter: int, group_id: int, state: int, key: int are attribute names, $ find (gid: int): PObjGroup, enter (), store (), lock (), write (), fix_gid (gid: int), get_pobjs (): Set *, get_po (oid: int): PObj, revive_links () are operation names.
[0069]
Further, in the persistent object class (PObj) 152, $ class_id: int, object_id: int, group_id: int, can_I_lock: int, state: int are attribute names, $ create (), store_group (), lock_group (), store_me (), set_all_linkid (), get_pog (): PObjGroup *, get_key (): int is an operation name.
[0070]
In the persistent object data storage class (PObjDS) 153, $ table_name: char *, $ primary_key: char * are attribute names, $ instance (): PObjDS *, load (oid: int): PObj *, insert (po) : PObj *), update (po: PObj *), and delete (po: PObj *) are operation names.
[0071]
The persistent object group class (PObjGroup) 151 and the persistent object class (PObj) 152 are in a “has_a” relationship (indicated by ◇ in the figure). In other words, it means that the persistent object group class (PObjGroup) 151 has a relationship with zero or more persistent object classes (PObj) 152 (indicated by * in the figure).
[0072]
FIG. 13 is a diagram illustrating an example of an application class definition according to the embodiment using an OMT (Unified_Method) notation.
As shown in FIG. 13A, there are classes of “customer”, “accommodation reservation”, “accommodation reservation details”, “room reservation”, and “room type” as subclasses of the persistent object class (PObj) 152. To do. Here, there is one “accommodation reservation” from the viewpoint of “customer” (indicated by 1 in the figure), and there are 0 or more “customers” from the viewpoint of “accommodation reservation” (indicated by * in the figure). It is in. In addition, from the “accommodation reservation”, the “accommodation reservation” has one or more “accommodation reservation details” (indicated by 1 in the figure). There is a relationship.
[0073]
Further, as shown in FIG. 13B, as a subclass of the persistent object data storage class (PObjDS) 153, “customer DS”, “accommodation reservation DS”, “accommodation reservation detail DS”, “room reservation DS”, Each class of “Room Type DS” exists.
[0074]
FIG. 14 is a diagram illustrating an example of an object actually generated in the accommodation reservation business application.
The customer object, the room reservation object, the room reservation detail object, the room reservation object, and the room type object shown in FIG. 14 constitute one group that is simultaneously extracted from the RDBMS for use in the room reservation business program. The customer object, the room reservation object, the room reservation detail object, and the room reservation object are objects to be locked because it is necessary to maintain data consistency when updating.
[0075]
15 and 16 are diagrams illustrating examples of management tables in the embodiment. 15A shows an example of an object / group configuration table 161, FIG. 15B shows an example of a group status table 162, and FIG. 15C shows an example of a link table 163. These tables hold data about the object group structure and group status. FIG. 16 is an example of tables 170 to 174 corresponding to each object. FIG. 16A shows a customer object table 170, FIG. 16B shows an accommodation reservation object table 171, and FIG. The room reservation object table 172 and FIG. 16D are the room reservation object table 173, and FIG. 16E is the room type object table 174.
[0076]
17 to 23 are diagrams illustrating an operation flow in the embodiment.
FIG. 17 is a diagram showing an operation flow when generating data of a new object group.
[0077]
11 is sent to the object group management information generation object OGGenerator 110 shown in FIG. 11, and the object group configuration data registration unit 111 operates by this, and the customer (customer) , Reservation (accommodation reservation), Rsv_for_night (accommodation reservation details), Rsv_for_room (room reservation), and Room_type (room reservation) objects are input (step S51).
[0078]
The object group configuration data registration unit 111 sequentially checks these input objects (step S52), and determines whether each object has an ID value (step S53). Here, when the object does not have an ID value, the object ID assignment unit 112 is activated by the instruction of “int OGGenerator :: assign_oid ()”, and the ID value is assigned to the object (step S54).
[0079]
After the same processing is performed for each object (step S55), the group ID assigning unit 114 is operated according to an instruction “int OGGenerator :: assign_gid ()”, and an ID value of a new group is assigned (step S56).
[0080]
Next, in response to an instruction “int OGGenerator :: create_group (PObjGroup * pog)”, the group data generation unit 113 is operated, and the ID value of each new group is stored in the object group configuration table 161 in combination with the ID value of each object. (Step S57). Also, a new row that is the ID value of the new group is added to the group status table 162 (step S58).
[0081]
FIG. 18 is a diagram showing a flow of operations when a group is specified and objects are taken out collectively.
An instruction of an operation retrieve_group using the group ID value as an argument is sent to the object / group management object OGManager 120 shown in FIG. 11, and the group fetching unit 121 operates thereby (step S61).
[0082]
The group extraction unit 121 searches the object group configuration table 161, and obtains the object ID (object_id) and class ID (class_id) from the line whose group_id value matches the input ID value (step S62). ). Further, the object / group configuration table 161 and the group state table 162 are referred to, and the lock value of the extracted row is checked (steps S63 and S64).
[0083]
If there is an object whose lock belongs to another group and is readlocked, a message indicating that the object cannot be extracted is issued (step S67), and the process is terminated.
[0084]
If the lock is not applied, the object generation instruction unit 128 is operated according to the instruction “PObj * OGManager :: load_obj (int oid, int cid)”, and the object is processed from the class_id of the object group configuration table 161. The responsible object is specified, and the object is requested to generate an object corresponding to object_id (step S65).
[0085]
As a result, an instruction “PObj * PObjDS :: load (int oid, int cid)” is issued, the object generation unit (not shown) operates, and the object generation unit uses the object ID (object_id), Data necessary for generating an object is extracted from the RDBMS 130, and an object is generated (step S66).
[0086]
FIG. 19 is a diagram showing an operation flow when a certain object is designated and all objects in the group to which the object belongs are extracted.
In response to an instruction “PObj * OGManager :: retrieve_og (int oid)”, an object ID value is input to the object group extraction unit 122 of the object group management object 120 (step S68). The object group extraction unit 122 searches the object group configuration table 161 and obtains the group ID from the line that matches the input ID value (step S69).
[0087]
Next, in response to an instruction “PObjGroup * OGManager :: retrieve_group (int gid)”, the group extraction unit 121 is called and a group ID is input to the group extraction unit 121 (step S70). As a result, all objects in the same group as the designated object are extracted.
[0088]
FIG. 20 is a diagram showing an operation flow when a group is locked.
In response to an instruction “int OGManager :: lock_group (int gid, int status)”, the group lock setting unit 123 operates, and the group ID value and the type of lock (read / write) are input (step S71). .
[0089]
The group lock setting unit 123 searches the group status table 162 and rewrites the value in the status column of the row whose value in the group_id column matches the input ID value to the input lock type (step S72). . Next, a key value for updating the locked data or releasing the lock is passed to the group (step S73).
[0090]
FIG. 21 is a diagram showing a flow of operations when releasing the group lock.
In response to an instruction “void OGManager :: unlock_group (int gid, int key)”, the group lock release unit 124 operates to input the group ID value and the key assigned at the time of lock setting (step S74). The group lock release unit 124 searches the group status table 162, matches the value of the key column in the table with the value of the input key, and the status of the row where the value of group_id matches the input ID value. The column value is rewritten to the unlocked state (steps S75 to S77). If the key values do not match, a message indicating that the lock cannot be released is issued (step S78).
[0091]
FIG. 22 is a diagram showing an operation flow when an object is updated collectively by specifying a group.
In response to an instruction of “void OGManager :: update_group (PObjGroup * pog, int key)”, the group update unit 125 operates and a group to be updated is input (S81). Next, in response to an instruction “int OGManager :: check_lock_status (int gid, int key)”, the group lock state check unit 126 is called to check whether the group can be updated (steps S82 and S83).
[0092]
If it can be updated, the object group configuration table 161 is searched, and the ID and class ID of the row object in which the value of group_id matches the input ID value and the lock is “yes” are obtained ( Step S84). Then, it instructs the object corresponding to the object ID to store data (step S85). In response to an instruction “void PObj :: store_me ()”, data corresponding to the object ID is updated (step S86). If the group to be updated is locked and cannot be updated, a message indicating that the group cannot be updated is output, and the process is terminated (step S87).
[0093]
FIG. 23 is a diagram illustrating an operation flow when an object is specified and all objects in the group to which the object belongs are updated.
In response to an instruction “void OGManager :: update_og (PObj * og, int key)”, the object group update unit 127 operates and an object to be updated is input (step S91). The object group updating unit 127 obtains a group (object) to which the object belongs from the input object (step S92). Next, a group is input to the group update unit 125 according to an instruction of “voidOGManager :: update_group (PObjGroup * pog, int key)”, and the group is updated together (step S93).
[0094]
【The invention's effect】
When updating an object, data consistency among objects cannot be maintained unless data associated with the object is retrieved, stored, locked / unlocked, and the like.
[0095]
According to the present invention, data consistency between related objects can be maintained by taking out, storing, locking / unlocking, etc. RDBMS data in groups of arbitrary objects. In particular, since the mechanism of the present invention can be added as an external function to various object-oriented language processors, the present invention can be easily applied to an existing object-oriented language using a relational database management system. There is an effect that it can be applied.
[Brief description of the drawings]
FIG. 1 is a diagram illustrating the principle of the present invention.
FIG. 2 is a diagram illustrating a configuration example in an embodiment.
FIG. 3 is a diagram illustrating a configuration example of a management table.
FIG. 4 is a diagram showing a flow of processing for generating group data.
FIG. 5 is a diagram showing a flow of processing for collectively retrieving objects by designating a group.
FIG. 6 is a diagram illustrating a flow of processing for designating a certain object and extracting all objects in a group to which the object belongs.
FIG. 7 is a diagram showing a flow of processing for locking a group.
FIG. 8 is a diagram showing a flow of processing for releasing a group lock;
FIG. 9 is a diagram illustrating a flow of processing for updating a group of objects by specifying a group.
FIG. 10 is a diagram showing a flow of processing for designating a certain object and updating all the objects in the group to which the object belongs.
FIG. 11 is a diagram showing a configuration of an example of the present invention.
FIG. 12 is a diagram illustrating an example of a permanent object in the embodiment.
FIG. 13 is a diagram illustrating an example of an application class definition in the embodiment.
FIG. 14 is a diagram illustrating an example of an object in the embodiment.
FIG. 15 is a diagram illustrating an example of a table in the embodiment.
FIG. 16 is a diagram illustrating an example of a table in the embodiment.
FIG. 17 is a diagram illustrating an operation flow when generating group data;
FIG. 18 is a diagram illustrating an operation flow when an object is collectively extracted by designating a group.
FIG. 19 is a diagram illustrating an operation flow when a certain object is designated and all objects in the group to which the object belongs are extracted.
FIG. 20 is a diagram illustrating an operation flow when a group is locked.
FIG. 21 is a diagram showing a flow of an operation when unlocking a group.
FIG. 22 is a diagram illustrating an operation flow when an object is updated collectively by designating a group.
FIG. 23 is a diagram showing an operation flow when an object is specified and all objects in the group to which the object belongs are updated.
[Explanation of symbols]
10 Object group management information generation device
20 Object group management device
30 Relational database management system (RDBMS)
40 relational database

Claims (5)

リレーショナル・データベース管理システムを用いて永続オブジェクトを管理する永続オブジェクト管理装置であって,
関連あるオブジェクトをグループとして管理するための,各オブジェクトとグループの対応関係を示すグループ構成データおよびグループの状態を示すグループ状態データを有するグループ管理情報を生成するオブジェクト・グループ管理情報生成装置と,
前記オブジェクト・グループ管理情報生成装置が生成したグループ管理情報をもとに,関連あるオブジェクトをまとめてリレーショナル・データベース管理システムから取り出すオブジェクト・グループ管理装置とを備え
前記オブジェクト・グループ管理情報生成装置は,
指定されたオブジェクトに,個々のオブジェクトを識別するユニークなID値をオブジェクトIDとして割り当てるオブジェクトID割当て手段と,
指定されたオブジェクトに対応するリレーショナル・データベースのテーブル中に,前記オブジェクトIDの格納領域を追加するオブジェクトIDデータ領域生成手段と,
新しいグループに,個々のグループを識別するためのユニークなID値をグループIDとして割り当て,グループIDと1つ以上のオブジェクトIDとの対応情報からなる前記グループ構成データおよびグループIDとその状態情報の組からなる前記グループ状態データとを生成するグループデータ生成手段と,
オブジェクトのグループを登録する際に呼び出され,アプリケーション・プログラムまたは管理用ユーザ・インタフェースからグループ指定された1つ以上のオブジェクトが入力されると,入力されたオブジェクトがオブジェクトIDを持っているかどうかを調べ,オブジェクトIDを持っていない場合には,前記オブジェクトID割当て手段によって,前記オブジェクトIDの割り当てを行い,入力されたオブジェクトに対応するリレーショナル・データベースのテーブル中に,オブジェクトIDの格納領域がない場合には,前記IDデータ領域生成手段によってその格納領域を当該テーブル中に追加し,前記オブジェクトIDを当該テーブル中の前記格納領域に設定し,前記グループデータ生成手段に前記グループ構成データと前記グループ状態データとを生成させるオブジェクト・グループ構成データ登録手段とを備える
ことを特徴とする永続オブジェクト管理装置。
A persistent object management device for managing persistent objects using a relational database management system,
An object / group management information generating device for generating group management information having group configuration data indicating a correspondence relationship between each object and a group and group status data indicating a group status for managing related objects as a group;
An object group management device that collects related objects from the relational database management system based on the group management information generated by the object group management information generation device ;
The object group management information generating device includes:
An object ID assigning means for assigning a unique ID value for identifying each object as an object ID to a specified object;
Object ID data area generation means for adding a storage area for the object ID in a relational database table corresponding to the specified object;
A unique ID value for identifying an individual group is assigned to a new group as a group ID, and the group configuration data including the correspondence information between the group ID and one or more object IDs, and a set of the group ID and its state information Group data generating means for generating the group state data comprising:
Called when registering a group of objects, and when one or more objects specified by the group are input from the application program or administrative user interface, it is checked whether the input object has an object ID. If no object ID is stored, the object ID is assigned by the object ID assigning means, and there is no storage area for the object ID in the relational database table corresponding to the input object. The ID data area generation means adds the storage area to the table, sets the object ID in the storage area in the table, and sends the group configuration data and the group to the group data generation means. Persistent object management apparatus characterized by comprising an object-group configuration data registration means for generating the up state data.
請求項1記載の永続オブジェクト管理装置において,
前記オブジェクト・グループ管理装置は,グループ内のオブジェクトをリレーショナル・データベース管理システムから取り出すと,前記グループ構成データをもとに同じグループに属する他のオブジェクトも自動的にまとめてリレーショナル・データベース管理システムから取り出す手段を備える
ことを特徴とする永続オブジェクト管理装置。
The persistent object management device according to claim 1,
When the object group management device retrieves the objects in the group from the relational database management system, it automatically collects other objects belonging to the same group from the relational database management system based on the group configuration data. A persistent object management device comprising: means.
請求項1記載の永続オブジェクト管理装置において,
前記オブジェクト・グループ管理装置は,前記グループ構成データをもとに関連のあるオブジェクトをまとめてリレーショナル・データベース管理システムに保存する手段を備える
ことを特徴とする永続オブジェクト管理装置。
The persistent object management device according to claim 1,
The object group management device comprises means for storing related objects together in a relational database management system based on the group configuration data .
請求項1記載の永続オブジェクト管理装置において,
前記オブジェクト・グループ管理装置は,グループ内のオブジェクトをリレーショナル・データベース管理システムに保存すると,前記グループ構成データをもとに同じグループに属する他のオブジェクトも自動的にまとめてリレーショナル・データベース管理システムに保存する手段を備える
ことを特徴とする永続オブジェクト管理装置。
The persistent object management device according to claim 1,
When the object group management device stores the objects in the group in the relational database management system, other objects belonging to the same group are automatically collected and stored in the relational database management system based on the group configuration data. A persistent object management device comprising: means for performing the operation.
請求項1記載の永続オブジェクト管理装置において,
前記オブジェクト・グループ管理装置は,オブジェクトのグループを単位としてロックを設定する手段およびロックを解除する手段を備え,
グループごとのロック状態の情報を前記グループ状態データとして記憶し,ロック状態のグループのオブジェクトに対する書き込みまたは読み出しのアクセスを禁止することにより,オブジェクト間の一貫性を保つ
ことを特徴とする永続オブジェクト管理装置。
The persistent object management device according to claim 1,
The object group management device comprises means for setting a lock in units of object groups and means for releasing the lock,
Persistent object management device characterized in that consistency information among objects is maintained by storing lock state information for each group as the group state data and prohibiting write or read access to objects in the locked group .
JP15656296A 1996-06-18 1996-06-18 Persistent object management unit Expired - Fee Related JP3857749B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP15656296A JP3857749B2 (en) 1996-06-18 1996-06-18 Persistent object management unit

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP15656296A JP3857749B2 (en) 1996-06-18 1996-06-18 Persistent object management unit

Publications (2)

Publication Number Publication Date
JPH103422A JPH103422A (en) 1998-01-06
JP3857749B2 true JP3857749B2 (en) 2006-12-13

Family

ID=15630509

Family Applications (1)

Application Number Title Priority Date Filing Date
JP15656296A Expired - Fee Related JP3857749B2 (en) 1996-06-18 1996-06-18 Persistent object management unit

Country Status (1)

Country Link
JP (1) JP3857749B2 (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4132441B2 (en) 1999-07-19 2008-08-13 富士通株式会社 Data management device for managed objects
JP5471023B2 (en) * 2009-05-11 2014-04-16 日本電気株式会社 Server, server control method, data distributed update system, and data distributed update program
JP6604787B2 (en) * 2015-09-11 2019-11-13 インフォサイエンス株式会社 Event information management system and event information management program

Also Published As

Publication number Publication date
JPH103422A (en) 1998-01-06

Similar Documents

Publication Publication Date Title
US6978260B2 (en) System and method for storing data
US6385618B1 (en) Integrating both modifications to an object model and modifications to a database into source code by an object-relational mapping tool
US5634048A (en) Distributed database system having a center system with a link file and a method for retrieving data from same
US7024656B1 (en) Persistent agents
US5893088A (en) System and method for performing database query using a marker table
Kakas et al. Database Updates through Abduction.
US9197597B2 (en) RDF object type and reification in the database
EP1393206B1 (en) Data structure for information systems
US7315850B2 (en) Software and method for performing database operations
EP0303231A2 (en) Method and device for enabling concurrent access of indexed sequential data files
US20050038671A1 (en) Identification mapping and translation method
KR19980702170A (en) Communication network database construction method and device
US7519608B2 (en) Secure virtual data warehousing system and method
JPH08255166A (en) Data management method and its system
KR101292430B1 (en) Reg10n-based security
CN107038222A (en) Database caches implementation method and its system
CN101013426B (en) Information management apparatus and method
US20060080282A1 (en) Data management method and storage medium storing data management program
JP3857749B2 (en) Persistent object management unit
CN116702892A (en) Knowledge base generation method and device, electronic equipment and storage medium
US8554722B2 (en) Method for transferring data into database systems
US6460028B1 (en) System and method for data organization
JPH07121417A (en) Data management device
Grissa-Touzi et al. New approach for the modeling and the implementation of the object-relational databases
JP3895898B2 (en) RDB system

Legal Events

Date Code Title Description
A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20060613

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20060811

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20060912

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20060915

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20090922

Year of fee payment: 3

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20100922

Year of fee payment: 4

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20100922

Year of fee payment: 4

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20110922

Year of fee payment: 5

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20120922

Year of fee payment: 6

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20120922

Year of fee payment: 6

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20130922

Year of fee payment: 7

LAPS Cancellation because of no payment of annual fees