JP5673431B2 - Information processing apparatus, information processing method, and program - Google Patents
Information processing apparatus, information processing method, and program Download PDFInfo
- Publication number
- JP5673431B2 JP5673431B2 JP2011174319A JP2011174319A JP5673431B2 JP 5673431 B2 JP5673431 B2 JP 5673431B2 JP 2011174319 A JP2011174319 A JP 2011174319A JP 2011174319 A JP2011174319 A JP 2011174319A JP 5673431 B2 JP5673431 B2 JP 5673431B2
- Authority
- JP
- Japan
- Prior art keywords
- class
- attribute
- field
- collection
- unit
- 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
Links
Images
Landscapes
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Description
本発明は、情報処理装置、情報処理方法、及びプログラムに関する。 The present invention relates to an information processing apparatus, an information processing method, and a program.
Java(登録商標)やC++等は、オブジェクト指向プログラム言語として知られている。オブジェクト指向プログラム言語を用いて作成されたプログラムでは、オブジェク間の協調動作によって機能が実現される。オブジェクトは、メソッドとデータとを有し、その構造はクラスとして定義される。換言すれば、オブジェクトは、クラスのインスタンス(実体)である。 Java (registered trademark), C ++, and the like are known as object-oriented programming languages. In a program created using an object-oriented programming language, a function is realized by a cooperative operation between objects. An object has methods and data, and its structure is defined as a class. In other words, an object is an instance of a class.
オブジェクトをデータベース等のデータストアに永続化する技法として、オブジェクト関係マッピング(ORM:Object Relation Mapping)が知られている。 Object relation mapping (ORM) is known as a technique for persisting objects in a data store such as a database.
図1は、オブジェクト関係マッピングを説明するための図である。同図に示されるように、オブジェクト関係マッピングでは、オブジェクトとデータストアのレコードとの対応付けが自動的に行われる。すなわち、オブジェクト関係マッピングでは、オブジェクトからデータストアのレコードへの変換、及びデータストアのレコードからオブジェクトへの変換等が自動的に行われる。また、オブジェクト関係マッピングでは、オブジェクト間の関連(参照関係)に関しても、自動的にデータストアのレコードとの対応付け及び変換が行われる。 FIG. 1 is a diagram for explaining object relationship mapping. As shown in the figure, in the object relationship mapping, the association between the object and the record of the data store is automatically performed. That is, in the object relationship mapping, conversion from an object to a data store record, conversion from a data store record to an object, and the like are automatically performed. Further, in the object relationship mapping, the association (reference relationship) between objects is automatically associated and converted with records in the data store.
図2は、参照関係を有するオブジェクトに関するオブジェクト関係マッピングの例を示す図である。 FIG. 2 is a diagram illustrating an example of object relationship mapping regarding objects having a reference relationship.
同図では、Employeeオブジェクトとdepartmentオブジェクトとが示されている。Employeeオブジェクトとdepartmentオブジェクトとの間には、参照関係R1が形成されている。すなわち、Employeeオブジェクトは、departmentオブジェクトを参照している。 In the figure, an Employee object and a department object are shown. A reference relationship R1 is formed between the Employee object and the department object. That is, the Employee object refers to the department object.
この場合、オブジェクト関係マッピングによれば、Employeeオブジェクトとdepartmentオブジェクトとは、それぞれに対応するテーブルのレコードに変換されて永続化される。同図では、Employeeオブジェクトは、テーブルT1のレコードに変換されて永続化される。また、departmentオブジェクトは、テーブルT2のレコードに変換されて永続化される。 In this case, according to the object relationship mapping, the Employee object and the department object are converted into a table record corresponding to each object and made permanent. In the figure, the Employee object is converted into a record of the table T1 and made permanent. The department object is converted into a record of the table T2 and is made permanent.
また、参照関係R1は、Employeeオブジェクトに対応するレコードの項目に変換されて永続化される。同図において、当該項目は、テーブルT1における、「部署ID<FK>」である。当該項目の値は、オブジェクト関係マッピングによって、テーブルT2のレコードに対応するオブジェクトへの参照関係であると解釈される。 Further, the reference relationship R1 is converted into a record item corresponding to the Employee object and made permanent. In the figure, the item is “Department ID <FK>” in the table T1. The value of the item is interpreted as a reference relationship to the object corresponding to the record in the table T2 by object relationship mapping.
上記より明らかなように、オブジェクト関係マッピングを利用することにより、オブジェクトを利用するアプリケーションプログラムのソースコード上では、オブジェクトの永続化先のデータストアの構造等が意識される必要はない。 As is clear from the above, by using the object relationship mapping, it is not necessary to be aware of the structure of the data store to which the object is persisted on the source code of the application program that uses the object.
なお、Java(登録商標)では,オブジェクト関係マッピングのAPI(Application Program Interface)の標準仕様としてJPA(Java(登録商標) Persistence API)及びJDO(Java(登録商標) Data Objects)等が策定されている。 In Java (registered trademark), JPA (Java (registered trademark) Persistence API), JDO (Java (registered trademark) Data Objects), and the like are established as standard specifications of API (Application Program Interface) for object relationship mapping. .
他方において、RDB(Relational Database:関係データストア)やKVS(Key-Value Store:キーバリューストア)等、特性の異なる複数のデータストアを併用することが、例えば、大規模なデータ処理が必要なシステムでは効果的であるとされている。そこで、斯かるシステムがオブジェクト指向プログラミングによって実装される場合、オブジェクト関係マッピングの実装(以下、「オブジェクト関係マッピング実装」という。)を利用して、各オブジェクトを特性の異なる複数のデータストアに分散して永続化することが考えられる。 On the other hand, using a plurality of data stores having different characteristics such as RDB (Relational Database) and KVS (Key-Value Store), for example, requires a large-scale data processing. It is said that it is effective. Therefore, when such a system is implemented by object-oriented programming, each object is distributed to a plurality of data stores having different characteristics using an implementation of object relationship mapping (hereinafter referred to as “object relationship mapping implementation”). It is possible to make it permanent.
しかしながら、通常、参照関係にあるオブジェクト群は、単一のデータストア内に永続化される必要がある。これは、各参照関係の整合性(参照先のオブジェクトがデータストア中に存在する状態)を単一のデータストア内で保とうとするオブジェクト関係マッピングの参照整合性制約のためである。したがって、参照整合性制約の下では、参照関係にある各オブジェクトを各々異なるデータストアに永続化することはできない。 Usually, however, objects in a reference relationship need to be persisted in a single data store. This is because of the referential integrity constraint of the object relationship mapping that attempts to maintain the consistency of each reference relationship (a state in which a reference destination object exists in the data store) within a single data store. Therefore, under the referential integrity constraint, each object in the reference relationship cannot be persisted to a different data store.
具体的には、参照先が複数であるオブジェクト間の参照関係は、参照元のオブジェクトにおいて、参照先のオブジェクトへの参照(オブジェクト参照)を要素とするコレクション型のフィールド(以下、「参照要素コレクションフィールド」という。)によって保持される。参照(参照)とは、オブジェクトを参照することを表すデータである。参照の値は、例えば、参照先のオブジェクトのメモリアドレスである。また、フィールドとは、オブジェクトが有する属性項目をいい、メンバ変数とも呼ばれる。また、コレクションとは、リストやセット等、複数のデータを格納できるデータ構造体をいう。 Specifically, the reference relationship between objects with multiple reference destinations is a collection-type field (hereinafter referred to as “reference element collection”) that has a reference to the reference destination object (object reference) as an element in the reference source object. Field ”). The reference (reference) is data indicating that an object is referred to. The reference value is, for example, the memory address of the reference destination object. A field refers to an attribute item that an object has and is also called a member variable. A collection refers to a data structure that can store a plurality of data such as lists and sets.
参照元のオブジェクトAをデータストアに永続化するには、オブジェクトAが有する参照要素コレクションフィールドが永続化対象としてオブジェクト関係マッピング実装に与えられる。しかし、オブジェクトAの永続化先のデータストアと、参照要素コレクションフィールドが参照するオブジェクト群の永続化先データストアが異なる場合、参照整合性制約により、オブジェクトAの永続化はエラーとなってしまう。 In order to persist the reference source object A in the data store, the reference element collection field of the object A is given to the object relationship mapping implementation as a persistence target. However, if the persistence destination data store of the object A is different from the persistence destination data store of the object group referenced by the reference element collection field, the persistence of the object A becomes an error due to the referential integrity constraint.
そこで、1側面では、オブジェクト間の参照関係を複数のデータストアに跨って永続化することのできる情報処理装置、情報処理方法、及びプログラムの提供を目的とする。 Therefore, an object of one aspect is to provide an information processing apparatus, an information processing method, and a program capable of perpetuating a reference relationship between objects across a plurality of data stores.
一つの案では、情報処理装置は、第一のクラスの属性のうち、第二のクラスのオブジェクトの集合である第一の属性が、永続化対象から除外されるように前記第一のクラスの定義情報を変更する除外部と、前記第二のクラスのオブジェクトの識別属性の値の集合である第二の属性を前記定義情報に追加する追加部と、前記第一の属性に対する前記第二のクラスのオブジェクトの集合の設定要求に応じた処理について、当該集合に含まれるそれぞれの前記第二のクラスのオブジェクトの前記識別属性の値の集合を前記第二の属性に設定するように、前記定義情報を変更する第一の変更部と、前記第一の属性の取得要求に応じた処理について、前記第一の属性に対する変更要求を前記第一の属性及び前記第二の属性に反映させる連動オブジェクトを返却するように、前記定義情報を変更する第二の変更部とを有する。 In one plan, the information processing apparatus includes the first class attribute so that the first attribute that is a set of objects of the second class is excluded from the persistence target among the attributes of the first class. An exclusion unit for changing definition information; an addition unit for adding a second attribute that is a set of identification attribute values of the second class object to the definition information; and the second attribute for the first attribute. For the processing according to the setting request for the class object set, the definition is set so that the set of the identification attribute values of the second class objects included in the set is set to the second attribute. A linked object that reflects a change request for the first attribute in the first attribute and the second attribute for the first change unit that changes information and the process according to the acquisition request for the first attribute As return to, and a second changing unit configured to change the definition information.
一態様によれば、オブジェクト間の参照関係を複数のデータストアに跨って永続化することができる。 According to one aspect, a reference relationship between objects can be made persistent across a plurality of data stores.
以下、図面に基づいて本発明の実施の形態を説明する。図3は、本発明の実施の形態における情報処理装置のハードウェア構成例を示す図である。同図の情報処理装置10は、それぞれバスBで相互に接続されているドライブ装置100、補助記憶装置102、メモリ装置103、CPU104、及びインタフェース装置105等を有する。
Hereinafter, embodiments of the present invention will be described with reference to the drawings. FIG. 3 is a diagram illustrating a hardware configuration example of the information processing apparatus according to the embodiment of the present invention. The
情報処理装置10での処理を実現するプログラムは、記録媒体101によって提供される。プログラムを記録した記録媒体101がドライブ装置100にセットされると、プログラムが記録媒体101からドライブ装置100を介して補助記憶装置102にインストールされる。但し、プログラムのインストールは必ずしも記録媒体101より行う必要はなく、ネットワークを介して他のコンピュータよりダウンロードするようにしてもよい。補助記憶装置102は、インストールされたプログラムを格納すると共に、必要なファイルやデータ等を格納する。
A program for realizing processing in the
メモリ装置103は、プログラムの起動指示があった場合に、補助記憶装置102からプログラムを読み出して格納する。CPU104は、メモリ装置103に格納されたプログラムに従って情報処理装置10に係る機能を実行する。インタフェース装置105は、ネットワークに接続するためのインタフェースとして用いられる。
The
なお、記録媒体101の一例としては、CD−ROM、DVDディスク、又はUSBメモリ等の可搬型の記録媒体が挙げられる。また、補助記憶装置102の一例としては、HDD(Hard Disk Drive)又はフラッシュメモリ等が挙げられる。記録媒体101及び補助記憶装置102のいずれについても、コンピュータ読み取り可能な記録媒体に相当する。
An example of the
図4は、本発明の実施の形態における情報処理装置の機能構成例を示す図である。同図において、情報処理装置10は、変更対象選択部11、クラス定義変更部12、連動コレクションオブジェクト生成部13、O/Rマッパーアクセス部14、O/Rマッパー部15a、及びO/Rマッパー部15b等を有する。これら各部は、情報処理装置10にインストールされたプログラムがCPU104に実行させる処理により実現される。また、情報処理装置10は、クラス定義ファイル記憶部21、オブジェクト配置定義記憶部22、データストア16a、及びデータストア16b等を有する。これら各記憶部又はデータストアは、補助記憶装置102又は情報処理装置10とネットワークを介して接続される記憶装置等を用いて実現可能である。
FIG. 4 is a diagram illustrating a functional configuration example of the information processing apparatus according to the embodiment of the present invention. In the figure, an
データストア16a及びデータストア16b(以下、双方を区別しない場合、「データストア16」という。)は、オブジェクトの永続化先として利用される、データベース等のデータストアである。本実施の形態において、データストア16a及びデータストア16bは、参照関係にあるオブジェクト群を、該参照関係を跨って永続化先する。
The
図5は、本実施の形態におけるオブジェクト間の参照関係の一例を示す図である。同図において、Departmentオブジェクトは、一つの部門を表現するDepartmentクラスのインスタンスである。Departmentオブジェクト(Departmentクラス)は、「id」又は「employees」等をフィールド名とするフィールドを有する。フィールドとは、オブジェクトが有する属性の項目をいい、メンバ変数とも呼ばれる。Departmentオブジェクトのidフィールドは、部門を一意に識別する情報(例えば、部門名)を値とする。employeesフィールドは、Employeeオブジェクトへの参照(オブジェクト参照)を要素とするコレクション型のオブジェクトである参照要素コレクションオブジェクトへの参照(オブジェクト参照)を値とする。すなわち、employeesフィールドは、Employeeオブジェクト(のオブジェクト参照)の集合である。参照(オブジェクト参照)とは、オブジェクトを参照することを表すデータである。参照の値は、例えば、参照先のオブジェクトのメモリアドレスである。なお、employeesフィールドのように、他のオブジェクトへの参照を要素とするコレクション型のフィールドを、以下「参照要素コレクションフィールド」という。 FIG. 5 is a diagram illustrating an example of a reference relationship between objects in the present embodiment. In the figure, a Department object is an instance of a Department class that represents one department. The Department object (Department class) has a field whose field name is “id” or “employees”. A field refers to an attribute item that an object has, and is also called a member variable. The id field of the Department object has information (for example, department name) that uniquely identifies the department as a value. The “employees” field takes a reference (object reference) to a reference element collection object, which is a collection type object having a reference (object reference) to the Employee object as an element. In other words, the employee field is a set of employee objects (object references). Reference (object reference) is data indicating that an object is referred to. The reference value is, for example, the memory address of the reference destination object. Note that a collection-type field whose elements are references to other objects, such as the “employees” field, is hereinafter referred to as “reference element collection field”.
Employeeオブジェクトは、一人の従業員を表現するEmployeeクラスのインスタンスである。同図において、Employeeオブジェクトは、「id」又は「name」等をフィールド名とするフィールドを有する。Employeeオブジェクトのidフィールドは、従業員を一意に識別する情報(例えば、社員番号等)を値とする。nameフィールドは、従業員の氏名を値とする。 The Employee object is an instance of the Employee class that represents a single employee. In the figure, the Employee object has a field whose field name is “id” or “name”. The id field of the Employee object has information (for example, employee number) uniquely identifying the employee as a value. The name field has the employee's name as a value.
同図において、Departmentオブジェクトは、emloyeesフィールドを介して、複数のEmployeeオブジェクトを参照している。すなわち、DepartmentオブジェクトとEmployeeオブジェクトとは、一対多の参照関係を有することが示されている。このことは、一つの部門に複数の従業員が属することを表現したものである。 In the figure, a Department object refers to a plurality of Employee objects via an emloyees field. That is, the department object and the employee object have a one-to-many reference relationship. This expresses that a plurality of employees belong to one department.
なお、本実施の形態において、各オブジェクトが表現する対象(本実施の形態では、部門又は従業員)を一意に識別可能なフィールドを、「識別属性」という。例えば、Employeeオブジェクトでは、idフィールドが識別属性に相当する。 In the present embodiment, a field that can uniquely identify a target (in this embodiment, a department or an employee) represented by each object is referred to as an “identification attribute”. For example, in the Employee object, the id field corresponds to the identification attribute.
図4に戻る。データストア16aは、Departmentオブジェクトの永続化先として利用されるデータストアである。データストア16bは、Employeeオブジェクトの永続化先として利用されるデータストアである。データストア16aは、例えば、RDB(Relational Database)であってもよい。データストア16bは、例えば、KVS(Key-Value Store)であてもよい。但し、データストア16a及びデータストア16bは、同様の形態のデータストアであってもよい。すなわち、双方がRDBであってもよいし、双方がKVSであってもよい。また、データストア16a及びデータストア16bは、RDBやKVS以外の形態のデータストアであってもよい。
Returning to FIG. The
O/Rマッパー部15aは、Departmentオブジェクト(Departmentクラス)に関する、オブジェクト関係マッピングの実装である。すなわち、O/Rマッパー部15aは、Departmentオブジェクトに関して、データストア16aのレコードへの変換(永続化)や、データストア16aのレコードからの変換等を行う。
The O /
O/Rマッパー部15bは、Employeeオブジェクト(Employeeクラス)に関する、オブジェクト関係マッピングの実装である。すなわち、O/Rマッパー部15bは、Employeeオブジェクトに関して、データストア16bのレコードへの変換や、データストア16aのレコードからの変換等を行う。
The O /
なお、O/Rマッパー部15a及びO/Rマッパー部15bは、例えば、オブジェクト関係マッピングの標準仕様であるJPA(Java(登録商標) Persistence API)及びJDO(Java(登録商標) Data Objects)等に準拠していてもよい。JPAに準拠する場合、O/Rマッパー部15a及びO/Rマッパー部15bは、EntityManagerに相当する。
Note that the O /
O/Rマッパーアクセス部14は、O/Rマッパー部15a及びO/Rマッパー部15b等の複数のO/Rマッパー部15をラッピングし、各オブジェクトの永続化先を各オブジェクトの利用者(本実施の形態では、アプリケーションプログラム17)から隠蔽する機能を有する。より詳しくは、O/Rマッパーアクセス部14は、O/Rマッパー部15a及びO/Rマッパー部15bと同様のAPI(Application Program Interface)を有し、永続化対象又はデータストア16からの取得対象のオブジェクトのクラスに応じて、O/Rマッパー部15a又はO/Rマッパー部15bに、永続化処理又は取得処理を委譲する。
The O / R
クラス定義ファイル記憶部21は、アプリケーションプログラム17から利用される各種のオブジェクトのクラスの定義情報が記録されたファイル(以下、「クラス定義ファイル」という。)を記憶する。クラスの定義情報とは、クラスが有するフィールド及びメソッド等に関する定義を示す情報をいう。すなわち、クラスの定義情報は、当該クラスのインスタンスであるオブジェクトの構造を示す情報であるともいえる。例えば、クラスの定義情報は、クラスのソースコードであってもよいし、Java(登録商標)バイトコードのように、クラスのソースコードがコンパイルされたものであって、かつ、編集可能なプログラム(例えば、Java(登録商標)クラスファイル)であってもよい。なお、アプリケーションプログラム17の機能は、所定のものに限定されない。アプリケーションプログラム17は、例えば、Webアプリケーションのように、クライアントからの要求に応じて処理を実行するアプリケーションであってもよいし、対話型のアプリケーションであってもよい。
The class definition
変更対象選択部11は、クラス定義ファイル記憶部21に記憶されているクラス定義ファイル群の中から、変更(又は変換)対象とするクラス定義ファイルを選択する。変更対象選択部11によって選択されたクラス定義ファイルを、以下、「変更対象クラス定義ファイル」という。本実施の形態では、他のクラスのオブジェクトを参照するクラスであって、当該他のクラスと永続化先のデータストア16が異なるクラスのクラス定義ファイルが、変更対象とされる。本実施の形態では、Departmentクラスのクラス定義ファイルが変更対象クラス定義ファイルとして選択される。なお、「変更」とは、クラス定義ファイルの内容の少なくとも一部を書き換えることをいう。
The change target selection unit 11 selects a class definition file to be changed (or converted) from the class definition file group stored in the class definition
クラス定義変更部12は、変更対象クラス定義ファイルに対して変更処理を実行し、変更後クラス定義ファイルf1を生成する。より詳しくは、クラス定義変更部12は、識別属性追加部121、参照属性除外部122、参照属性設定メソッド変更部123、及び参照属性取得メソッド変更部124等を含む。
The class
識別属性追加部121は、変更対象クラス定義ファイルに係るクラスのオブジェクトから参照されるオブジェクトの識別属性の値を要素とするコレクション型のオブジェクト(以下、「識別要素コレクションオブジェクト」という。)を値とするフィールド(以下、「識別要素コレクションフィールド」という。)の定義を、変更対象クラス定義ファイルに追加する。すなわち、本実施の形態において、識別属性追加部121は、Employeeオブジェクトのidフィールドの値を要素とする識別要素コレクションフィールドの定義を、Departmentクラスのクラス定義ファイルに対して追加する。
The identification
図6は、Departmentオブジェクトに識別要素コレクションフィールドが追加された状態を示す図である。 FIG. 6 is a diagram showing a state in which an identification element collection field is added to the Department object.
同図において、Departmentオブジェクトには、「employeesIds」をフィールド名とするフィールドが追加されている。employeesIdsフィールドが、識別要素コレクションフィールドである。employeesIdsフィールドに設定(代入)される識別要素コレクションオブジェクトには、参照要素コレクションフィールドであるempoeesフィールドの要素であるEmployeeオブジェクトのidフィールドの値の集合が格納される。 In the figure, a field having “employeesIds” as a field name is added to the Department object. The employeesIds field is an identification element collection field. In the identification element collection object set (assigned) in the employeesIds field, a set of id field values of the employee object that is an element of the employees field that is a reference element collection field is stored.
識別属性追加部121は、また、識別要素コレクションフィールドに関するsetterとgetterとを変更対象クラス定義ファイルに追加する。setterとは、当該setterが対応するフィールドへの値の設定要求を受け付けるメソッドである。getterとは、当該getterが対応するフィールドの値の取得要求を受け付けるメソッドである。
The identification
参照属性除外部122は、変更対象クラス定義ファイルに含まれている、参照要素コレクションフィールド(employeesフィールド)を、オブジェクト関係マッピングの実装(O/Rマッパー部15a)による永続化の対象から除外するための処理を実行する。具体的には、参照属性除外部122は、変更対象クラス定義ファイルに含まれている参照要素コレクションフィールドに対して、永続化の対象外であることを示す修飾子(後述される@Transientアノテーション)を付加する。なお、@Transientアノテーションは、JPAを用いる場合に有効な修飾子であり、例えば、JDOを用いる場合には、@NotPersistentが当該修飾子として付加されればよい。
The reference
参照要素コレクションフィールドが、永続化対象から除外されるのは、オブジェクト関係マッピングの参照整合性制約によるエラーの発生を回避するためである。すなわち、本実施の形態において、Departmentオブジェクトは、データストア16aに永続化され、Employeeオブジェクトは、データストア16bに永続化される。このような状況において、Departmentオブジェクトの参照要素コレクションフィールドであるemployeesフィールドが、O/Rマッパー部15aによってそのままデータストア16aに永続化される場合を考える。この場合、employeesフィールドによって参照される各Employeeオブジェクトは、上記参照整合性制約によって、データストア16aに存在することが要求される。しかし、Employeeオブジェクトは、データストア16aには永続化されないため、上記参照整合性制約を満たすことができない。その結果、Departmentオブジェクトの永続化はエラーとなってしまう。斯かる事態の発生を回避するため、参照要素コレクションフィールドは、永続化対象から除外されるのである。
The reason why the reference element collection field is excluded from the persistence target is to avoid the occurrence of an error due to the referential integrity constraint of the object relationship mapping. That is, in the present embodiment, the Department object is persisted in the
参照要素コレクションフィールドが永続化対象から除外される代わりに、Departmentオブジェクトが参照する各Employeeオブジェクトの識別属性の値を要素とする識別要素コレクションフィールドが、永続化される。その結果、DepartmentオブジェクトとEmployeeオブジェクトとの参照関係が、双方のオブジェクトの永続化によって失われてしまうことを回避することができる。後述されるように、永続化される識別要素コレクションフィールドに基づいて、永続後の各Departmentオブジェクトの参照先であるEmployeeオブジェクトを特定することができるからである。 Instead of excluding the reference element collection field from the persistence target, the identification element collection field whose element is the value of the identification attribute of each Employee object referenced by the Department object is persisted. As a result, it is possible to avoid that the reference relationship between the Department object and the Employee object is lost due to the persistence of both objects. This is because, as will be described later, based on the identification element collection field that is made permanent, the Employee object that is the reference destination of each Department object that is made permanent can be specified.
なお、識別要素コレクションフィールドがO/Rマッパー部15aを介してデータストア16aに永続化されたとしても、参照整合性制約によるエラーは発生しない。識別要素コレクションフィールドの要素は、参照ではなく、文字列又は数値等の一般的なデータ型の値である。したがって、O/Rマッパー部15aやデータストア16aは、識別要素コレクションフィールドを、単なる文字列又は数値等の集合として扱うからである。
Even if the identification element collection field is made permanent in the
参照属性設定メソッド変更部123は、変更対象クラス定義ファイルにおける、参照要素コレクションフィールドのsetterの定義内容に関して変更を行う。すなわち、本実施の形態において、参照属性設定メソッド変更部123は、Departmentオブジェクトのemployeesフィールドに関するsetterの定義内容に関して変更を行う。具体的には、参照属性設定メソッド変更部123は、例えば、図7に示されるような状態のDepartmentオブジェクト及びEmployeeオブジェクトに関して、図8に示されるような参照関係が形成されるように、当該setterの定義内容を変更する。
The reference attribute setting
図7は、参照要素コレクションフィールドのsetterの呼び出し前のDepartmentオブジェクトの状態を示す図である。 FIG. 7 is a diagram illustrating the state of the Department object before calling the setter of the reference element collection field.
同図におけるDepartmentオブジェクトにおいて、employeesフィールド及びemployeesIdsフィールドの値は空である。例えば、Departmentオブジェクトが生成された直後の状態を想定するとよい。 In the Department object in the figure, the values of the employees field and the employeesIds field are empty. For example, a state immediately after the Department object is generated may be assumed.
このような状態において、Departmentオブジェクトの参照要素コレクションフィールド(employeesフィールド)のsetterの引数に、同図に示される指定される参照要素コレクションオブジェクトが指定されると、変更後のsetterは、図8に示されるような状態を生成する。 In this state, when the specified reference element collection object shown in the figure is specified as the setter argument of the reference element collection field (employees field) of the Department object, the changed setter is shown in FIG. Generate a state as shown.
図8は、参照要素コレクションフィールドのsetterの呼び出し後のDepartmentオブジェクトの状態を示す図である。 FIG. 8 is a diagram illustrating the state of the Department object after calling the setter of the reference element collection field.
変更後のsetterは、呼び出しに応じ、連動コレクションオブジェクトの生成を連動コレクションオブジェクト生成部13に実行させる。同図に示されるように、連動コレクションオブジェクトは、「vals」又は「ids」をフィールド名とするフィールドを有する。valsフィールドには、当該setterの引数に指定された参照要素コレクションオブジェクトへの参照が設定される。また、idsフィールドには、参照要素コレクションオブジェクトから参照されている各Employeeオブジェクトのidフィールドの値を要素とする識別要素コレクションオブジェクトへの参照が設定される。当該識別要素コレクションオブジェクトへの参照は、DepartmentオブジェクトのemployeesIdsフィールドにも設定される。更に、連動コレクションオブジェクトへの参照が、Departmentオブジェクトのemployeesフィールドに設定される。以上の結果、図8に示されるような、参照関係が形成される。
The changed setter causes the linked collection
参照属性取得メソッド変更部124は、変更対象クラス定義ファイルにおける、参照要素コレクションフィールドのgetterの定義内容に関して変更を行う。すなわち、本実施の形態において、参照属性取得メソッド変更部124は、Departmentオブジェクトのemployeesフィールドに関するgetterの定義内容に関して変更を行う。具体的には、参照属性取得メソッド変更部124は、当該getterについて、Departmentオブジェクトのemployeesフィールドに連動コレクションオブジェクトへの参照が設定されている場合には、当該連動コレクションオブジェクトへの参照を返却するように定義内容を変更する。employeesフィールドに連動コレクションオブジェクトへの参照が設定されている場合とは、例えば、Departmentオブジェクトが、図8に示されるような状態を有する場合である。
The reference attribute acquisition
また、参照属性取得メソッド変更部124は、当該getterについて、employeesフィールドに連動コレクションオブジェクトへの参照が設定されていない場合は、次のような処理を実行するように定義内容を変更する。
In addition, when the reference to the linked collection object is not set in the employees field for the getter, the reference attribute acquisition
図9は、employeesフィールドに連動コレクションオブジェクトへの参照が設定されていないDepartmentオブジェクトの状態を示す図である。 FIG. 9 is a diagram illustrating a state of a Department object in which the reference to the linked collection object is not set in the employees field.
同図のDepartmentオブジェクトにおいて、employeesフィールドの値は空である。一方、employeesIdsフィールドには、識別要素コレクションオブジェクトへの参照が設定されている。例えば、同図は、データストア16aに永続化されていたDepartmentオブジェクトが、データストア16aより取得された直後の状態を示す。
In the Department object shown in the figure, the value of the employees field is empty. On the other hand, a reference to the identification element collection object is set in the employeesIds field. For example, the figure shows a state immediately after the Department object that has been made permanent in the
Departmentオブジェクトが図9に示される状態である場合、変更後のgetter内では、識別要素コレクションオブジェクトに含まれている各数値オブジェクトをキーとして、Employeeオブジェクト群が、O/Rマッパー部15bを介してデータストア16bより取得される。更に、取得されたEmployeeオブジェクトを要素とする参照要素コレクションオブジェクトが生成される。また、連動コレクションオブジェクトが生成され、当該連動コレクションオブジェクトのvalsフィールドに、当該参照要素コレクションオブジェクトへの参照が設定される。また、当該連動コレクションオブジェクトのidsフィールドには、図9に示される識別要素コレクションオブジェクトへの参照が設定される。また、当該連動コレクションオブジェクトへの参照が、Departmentオブジェクトのemployeesフィールドに設定される。その結果、変更後のgetterの呼び出しに応じ、図8において説明した状態が生成される。なお、変更後のgetterは、employeesフィールドの値、すなわち、連動コレクションオブジェクトへの参照を、返却する。
When the Department object is in the state shown in FIG. 9, in the changed getter, the Employee object group is passed through the O /
後述されるように、連動コレクションオブジェクトは、参照要素コレクションオブジェクトと同じインタフェース(Listインタフェース)を実装する。したがって、当該getterの呼び出し元のアプリケーションプログラム17は、返却された連動コレクションオブジェクトを参照要素コレクションオブジェクトとして扱う。このことは、変更対象クラス定義ファイルの変更に関して、アプリケーションプログラム17のソースコード等は影響を受けないことを意味する。
As will be described later, the conjunction collection object implements the same interface (List interface) as the reference element collection object. Therefore, the
例えば、アプリケーションプログラム17は、連動コレクションオブジェクトに対して、Employeeオブジェクトの取得、追加、又は削除を要求する。斯かる要求に応じて、連動コレクションオブジェクトは、次のように振る舞う。
For example, the
図10は、連動コレクションオブジェクトを説明するための図である。同図に示されるように、連動コレクションオブジェクトは、Employeeオブジェクトの取得、追加、又は削除の要求に応じた処理を、valsフィールドに設定されている参照要素コレクションオブジェクトに委譲する。したがって、参照要素コレクションオブジェクトにおいて、Employeeオブジェクトの取得、追加、又は削除が実行される。連動コレクションオブジェクトは、更に、参照要素コレクションオブジェクトにおけるEmployeeオブジェクトの追加又は削除を、idsフィールドに設定されている識別要素コレクションオブジェクトに反映する。具体的には、連動コレクションオブジェクトは、追加対象のEmployeeオブジェクトのidフィールドの値を、当該識別要素コレクションオブジェクトに追加する。また、連動コレクションオブジェクトは、削除対象のEmployeeオブジェクトのidフィールドの値を、当該識別要素コレクションオブジェクトより削除する。 FIG. 10 is a diagram for explaining the linked collection object. As shown in the figure, the conjunction collection object delegates the processing according to the request for acquisition, addition, or deletion of the employee object to the reference element collection object set in the vals field. Accordingly, the acquisition, addition, or deletion of the Employee object is executed in the reference element collection object. The linked collection object further reflects the addition or deletion of the Employee object in the reference element collection object in the identification element collection object set in the ids field. Specifically, the linked collection object adds the id field value of the addition-target Employee object to the identification element collection object. In addition, the linked collection object deletes the value of the id field of the Employee object to be deleted from the identification element collection object.
連動コレクションオブジェクトに上記のような処理を実行させるために、例えば、連動コレクションオブジェクトのクラス(連動コレクションクラス)は、図11に示されるように定義される。 In order to cause the linked collection object to execute the process as described above, for example, the class of the linked collection object (linked collection class) is defined as shown in FIG.
図11は、連動コレクションクラスの定義例を示す図である。同図では、連動コレクションクラスのクラス名は、「MetaList」である例が示されている。 FIG. 11 is a diagram illustrating a definition example of a linked collection class. In the drawing, an example in which the class name of the linked collection class is “MetaList” is shown.
同図において、記述316は、MetaListクラス(連動コレクションクラス)が、コレクション型の一例であるListインタフェースを実装することを示す。なお、後述されるように、参照要素コレクションオブジェクトも、Listインタフェースを実装する。 In the figure, a description 316 indicates that the MetaList class (linked collection class) implements a List interface that is an example of a collection type. As will be described later, the reference element collection object also implements the List interface.
記述d311は、valsフィールドの定義である。記述d312は、idsフィールドの定義である。記述d313は、idsフィールドのgetterである、getIdsメソッドの定義である。なお、idsフィールドのsetter、並びにvalsフィールドのgetter及びsetterに関する定義は、便宜上省略されている。 The description d311 is the definition of the vals field. The description d312 is the definition of the ids field. A description d313 is a definition of a getIds method that is a getter of the ids field. In addition, the definition regarding the setter in the ids field and the getter and setter in the vals field are omitted for convenience.
記述d314は、Listインタフェースにおいて定義されているaddメソッドの実装である。addメソッドは、引数に指定される、MetaEntityインタフェースを実装するクラスのオブジェクトの追加要求に応じた処理を実行する。MetaListクラスのaddメソッドには、識別要素コレクションオブジェクト及び参照要素コレクションオブジェクトのそれぞれへの要素の追加処理が定義されている。 The description d314 is an implementation of the add method defined in the List interface. The add method executes processing corresponding to a request for adding an object of a class that implements the MetaEntity interface, which is specified as an argument. In the add method of the MetaList class, element addition processing is defined for each of the identification element collection object and the reference element collection object.
記述d315は、Listインタフェースにおいて定義されているremoveメソッドの実装である。MetaListクラスのremoveメソッドは、引数に指定される、MetaEntityインタフェースを実装するクラスのオブジェクトの削除要求に応じた処理を実行する。MetaListクラスのremoveメソッドには、識別要素コレクションオブジェクト及び参照要素コレクションオブジェクトのそれぞれからの要素の削除処理が定義されている。 The description d315 is an implementation of the remove method defined in the List interface. The remove method of the MetaList class executes processing according to a request for deleting an object of a class that implements the MetaEntity interface, which is specified as an argument. In the remove method of the MetaList class, deletion processing of elements from each of the identification element collection object and the reference element collection object is defined.
なお、本実施の形態では、Employeeオブジェクトが、addメソッド及びremoveメソッド等の引数に指定される。すなわち、Employeeクラスは、MetaEntityインタフェースを実装する。 In the present embodiment, the Employee object is designated as an argument such as an add method and a remove method. That is, the Employee class implements the MetaEntity interface.
このように、連動コレクションオブジェクトは、参照要素コレクションオブジェクトと、識別要素コレクションオブジェクトとの状態を連動又は同期させ、その結果として、双方の間に常に整合性が確保されるようする。 In this way, the linked collection object links or synchronizes the states of the reference element collection object and the identification element collection object, and as a result, consistency is always ensured between the two.
連動コレクションオブジェクトの導入意義又は存在意義の一つは、例えば、次の通りである。 One of introduction significance or existence significance of the linked collection object is, for example, as follows.
オブジェクト指向プログラムにおいて、或るオブジェクトのフィールドの値は、ローカル変数(一時的に利用可能なデータ格納域)等に代表される左辺値に代入することが可能である。このような性質は、コレクションオブジェクトへの参照を値とするフィールドに関しても同様である。 In an object-oriented program, the value of a field of a certain object can be assigned to a left-side value represented by a local variable (temporarily usable data storage area) or the like. This property is the same for a field whose value is a reference to a collection object.
したがって、例えば、Departmentオブジェクトが図6に示されるような状態において、emploeesフィールドに関する変更前のgetterの呼び出されたとする。この場合、emploeesフィールドに設定されている参照要素コレクションオブジェクトへの参照が、getterの呼び出し元のアプリケーションプログラム17のローカル変数に代入される可能性がある。そして、アプリケーションプログラム17によって、当該ローカル変数を介して、参照要素コレクションフィールドへのEmployeeオブジェクトの追加又は削除等が実行される可能性がある。
Therefore, for example, it is assumed that the getter before the change related to the employees field is called in the state where the Department object is as shown in FIG. In this case, there is a possibility that a reference to the reference element collection object set in the employees field is assigned to a local variable of the
しかしながら、Departmentオブジェクトは、当該ローカル変数を介した参照要素コレクションフィールドへのEmployeeオブジェクトの追加又は削除を検知することはできない。当該ローカル変数は、Departmentオブジェクトとは関係を有さないからである。したがって、参照要素コレクションフィールドに追加されたEmployeeオブジェクトのidフィールドの値は、識別要素コレクションフィールドには追加されない。その結果、参照要素コレクションフィールドと識別要素コレクションフィールドとの間に不整合が発生してしまう。 However, the Department object cannot detect the addition or deletion of the Employee object to the reference element collection field via the local variable. This is because the local variable has no relationship with the Department object. Therefore, the value of the id field of the Employee object added to the reference element collection field is not added to the identification element collection field. As a result, a mismatch occurs between the reference element collection field and the identification element collection field.
上記したように、参照要素コレクションフィールドと識別要素コレクションフィールドとのうち、永続化の対象とされるのは、識別要素コレクションフィールドのみである。そうすると、参照要素コレクションフィールドに対する変更が、正しく永続化されないことになってしまう。すなわち、一般的に「ダーティチェック」と呼ばれる機能を有効に作用させることができなくなってしまう。ダーティチェックとは、メモリ上におけるオブジェクト間の参照関係と、データストアにおいて永続化されているレコード間の参照関係との間の差分を自動的に検出し、当該差分をデータストアに反映する機能をいう。 As described above, of the reference element collection field and the identification element collection field, only the identification element collection field is targeted for persistence. Then, changes to the reference element collection field will not be properly persisted. That is, a function generally called “dirty check” cannot be effectively operated. Dirty check is a function that automatically detects the difference between the reference relationship between objects in memory and the reference relationship between records persisted in the data store, and reflects the difference in the data store. Say.
一方、Departmentオブジェクトが、図8に示されるような状態であれば、emploeesフィールドに関する変更後のgetterの呼び出しによって、連動コレクションオブジェクトへの参照が、getterの呼び出し元のアプリケーションプログラム17のローカル変数に代入される。そして、当該ローカル変数を介したEmployeeオブジェクトの追加又は削除等は、図10において説明したように、連動コレクションオブジェクトによって、参照要素コレクションオブジェクト及び識別要素コレクションオブジェクトの双方に反映される。その結果、ダーティチェックを有効に作用させることができる。
On the other hand, if the Department object is in the state as shown in FIG. 8, a reference to the linked collection object is assigned to a local variable of the
このような理由から、本実施の形態では、連動コレクションオブジェクトが導入されているのである。 For this reason, a linked collection object is introduced in the present embodiment.
以下、情報処理装置10が実行する処理手順について説明する。図12は、変更対象クラス定義ファイルの選択処理の処理手順の一例を説明するためのフローチャートである。
Hereinafter, a processing procedure executed by the
ステップS101において、変更対象選択部11は、クラス定義ファイル記憶部21に記憶されているクラス定義ファイル群の中から一つのクラス定義ファイルを選択して当該クラス定義ファイルを読み込む。選択されたクラス定義ファイルに係るクラスを、以下「対象クラス」という。例えば、Departmentクラスのクラス定義ファイルが選択された場合、図13に示される定義情報が読み込まれる。
In step S <b> 101, the change target selection unit 11 selects one class definition file from the class definition file group stored in the class definition
図13は、Departmentクラスのクラス定義ファイルの定義例を示す図である。 FIG. 13 is a diagram illustrating a definition example of a class definition file of a Department class.
同図に示されるクラス定義ファイルC1において、記述d111は、idフィールドの定義である。記述d112は、idフィールドのgetterである、getIdメソッドの定義である。記述d113は、idフィールドのsetterである、setIdメソッドの定義である。 In the class definition file C1 shown in the figure, the description d111 is the definition of the id field. A description d112 is a definition of a getId method that is a getter of the id field. A description d113 is a definition of a setId method which is a setter of the id field.
記述d114は、参照要素コレクションフィールドである、employeesフィールドの定義である。すなわち、employeesフィールドは、Employeeオブジェクトへの参照を要素とするList型のフィールドである。なお、List型とは、コレクション型の一種である。記述d115は、employeesフィールドのgetterである、getEmployeesメソッドの定義である。記述d116は、employeesフィールドのsetterである、setEmployeesメソッドの定義である。記述d117は、MetaEntityインタフェースにおいて定義されている、getPrimaryKeyメソッドに対する実装である。すなわち、記述d118において、Departmentクラスは、JPAで定義されているMetaEntityインタフェースを実装することが示されている。したがって、Departmentクラスは、MetaEntityインタフェースで定義されているメソッドの実装を含むのである。なお、getPrimaryKeyメソッドは、プライマリキー(すなわち、オブジェクトごとに一意な識別属性の値)を返却するメソッドである。したがって、Deparmentクラスにおいて実装されたgetPrimaryKeyメソッドでは、idフィールドの値が返却される。 A description d114 is a definition of an employees field that is a reference element collection field. In other words, the employee field is a List type field whose element is a reference to the Employee object. The List type is a kind of collection type. A description d115 is a definition of a getEmployees method that is a getter of the employees field. A description d116 is a definition of a setEmployees method which is a setter of the employees field. Description d117 is an implementation for the getPrimaryKey method defined in the MetaEntity interface. In other words, the description d118 indicates that the Department class implements the MetaEntity interface defined by JPA. Therefore, the Department class includes an implementation of the method defined in the MetaEntity interface. The getPrimaryKey method is a method that returns a primary key (that is, a unique identification attribute value for each object). Therefore, in the getPrimaryKey method implemented in the Department class, the value of the id field is returned.
また、Employeeクラスのクラス定義ファイルが選択された場合、図14に示される定義情報が読み込まれる。 When the class definition file of the Employee class is selected, the definition information shown in FIG. 14 is read.
図14は、Employeeクラスのクラス定義ファイルの定義例を示す図である。 FIG. 14 is a diagram illustrating a definition example of the class definition file of the Employee class.
同図に示されるクラス定義ファイルC2において、記述d211は、idフィールドの定義である。記述d212は、idフィールドのgetterである、getIdメソッドの定義である。記述d213は、idフィールドのsetterである、setIdメソッドの定義である。記述d214は、MetaEntityインタフェースにおいて定義されている、getPrimaryKeyメソッドに対する実装である。すなわち、記述d215において、Employeeクラスは、MetaEntityインタフェースを実装することが示されている。したがって、Employeeクラスは、MetaEntityインタフェースで定義されているメソッドの実装を含むのである。Employeeクラスにおいて実装されたgetPrimaryKeyメソッドでは、idフィールドの値が返却される。 In the class definition file C2 shown in the figure, the description d211 is the definition of the id field. A description d212 is a definition of a getId method that is a getter of the id field. The description d213 is a definition of a setId method that is a setter of the id field. The description d214 is an implementation for the getPrimaryKey method defined in the MetaEntity interface. In other words, the description d215 indicates that the Employee class implements the MetaEntity interface. Therefore, the Employee class includes an implementation of the method defined in the MetaEntity interface. In the getPrimaryKey method implemented in the Employee class, the value of the id field is returned.
続いて、変更対象選択部11は、対象クラス定義ファイルには、オブジェクトへの参照を要素とするコレクション型のフィールド(参照要素コレクションフィールド)が有るか否かを判定する(S102)。当該判定は、例えば、@OneToManyアノテーションが付加されているフィールドの有無に基づいて行われる。すなわち、@OnToManyアノテーションは、当該アノテーションが付加されたフィールドが一対多の参照関係を保持するためのフィールドであることを示す修飾子である。 Subsequently, the change target selection unit 11 determines whether or not the target class definition file includes a collection type field (reference element collection field) having a reference to the object as an element (S102). This determination is performed based on, for example, the presence or absence of a field to which the @OneToMany annotation is added. That is, the @OnToMany annotation is a qualifier indicating that the field to which the annotation is added is a field for holding a one-to-many reference relationship.
図13に示される、Departmentクラスのクラス定義ファイルC1には、記述d114において@OnToManyアノテーションが含まれている。したがって、クラス定義ファイルC1が対象クラス定義ファイルである場合、ステップS102の判定はYesとなる。 The class definition file C1 of the Department class shown in FIG. 13 includes the @OnToMany annotation in the description d114. Therefore, when the class definition file C1 is the target class definition file, the determination in step S102 is Yes.
一方、図14に示される、Employeeクラスのクラス定義ファイルC2には、@OnToManyアノテーションは含まれていない。したがって、クラス定義ファイルC2が対象クラス定義ファイルである場合、ステップS102の判定はNoとなる。 On the other hand, the class definition file C2 for the Employee class shown in FIG. 14 does not include the @OnToMany annotation. Therefore, when the class definition file C2 is the target class definition file, the determination in step S102 is No.
なお、@OnToManyアノテーションの有無ではなく、コレクション型のフィールドであって、コレクションの要素が他のクラスのオブジェクトへの参照であるフィールドの有無に基づいてステップS102の判定が行われてもよい。 Note that the determination in step S102 may be performed based on whether or not there is a field of a collection type and a collection element is a reference to an object of another class, instead of the presence or absence of the @OnToMany annotation.
すなわち、Departmentクラスのクラス定義ファイルC1(図13)の記述d114には、Employeeクラスのオブジェクトへの参照を要素とするコレクション型(List型)のemploeesフィールドが含まれている。したがって、クラス定義ファイルC1に関して、ステップS102の判定はYesとなる。 In other words, the description d114 of the class definition file C1 (FIG. 13) of the Department class includes a collection type (List type) employees field having a reference to the object of the Employee class as an element. Therefore, regarding the class definition file C1, the determination in step S102 is Yes.
一方、Employeeクラスのクラス定義ファイルC2(図14)には、参照を要素とするコレクション型のフィールドは含まれていない。したがって、クラス定義ファイルC2に関して、ステップS102の判定はNoとなる。 On the other hand, the class definition file C2 (FIG. 14) of the Employee class does not include a collection type field whose element is a reference. Therefore, the determination in step S102 is No for the class definition file C2.
対象クラス定義ファイルに参照要素コレクションフィールドが有る場合(S102でYes)、変更対象選択部11は、対象クラス定義ファイルに係るクラス(以下、「対象クラス」という。)のオブジェクトの永続化先と、当該参照要素コレクションフィールドにおいて参照先として指定されているクラス(以下、「参照先クラス」という。)のオブジェクトの永続化先とが異なるか否かを判定する(S103)。当該判定は、オブジェクト配置定義記憶部22を参照して行われる。
When the target class definition file includes a reference element collection field (Yes in S102), the change target selection unit 11 includes a persistence destination of an object of a class related to the target class definition file (hereinafter referred to as “target class”), It is determined whether or not the object persistence destination of a class (hereinafter referred to as “reference destination class”) designated as a reference destination in the reference element collection field is different (S103). This determination is made with reference to the object arrangement
図15は、オブジェクト配置定義記憶部の構成例を示す図である。同図において、オブジェクト配置定義記憶部22は、永続化対象とされるオブジェクトのクラスごとに、クラス名、O/RマッパーID、及び永続化ユニット名等を記憶する。クラス名は、永続化対象とされるオブジェクトのクラスの名前である。O/RマッパーIDは、各クラスのオブジェクトの永続化等を実行するO/Rマッパー部15の識別子である。本実施の形態では、Departmentクラスのオブジェクトは、O/Rマッパー部15aによって永続化される。Employeeクラスのオブジェクトは、O/Rマッパー部15bによって永続化される。したがって、Departmentクラスに対しては、O/Rマッパー部15aのO/RマッパーIDが記憶され、Employeeクラスに対しては、O/Rマッパー部15bのO/RマッパーIDが記憶されている。永続化ユニット名は、永続化ユニットの名前である。永続化ユニットとは、JPAにおいて、O/Rマッパー部15に対する設定情報が記述されたファイルをいう。例えば、各O/Rマッパー部15は、永続化ユニットに記述された設定情報に基づいて、永続化先のデータストア16の識別等を行う。
FIG. 15 is a diagram illustrating a configuration example of the object arrangement definition storage unit. In the figure, the object arrangement
オブジェクト配置定義記憶部22において、O/RマッパーIDが異なるということは、永続化先が異なるということになる。したがって、上記したステップS103において、変更対象選択部11は、対象クラスに対応するO/RマッパーIDと、参照先クラスに対応するO/RマッパーIDとが異なるか否かに基づいて、双方のクラスのオブジェクトの永続化先の異同を判定する。
In the object arrangement
例えば、対象クラスがDepartmentクラスの場合、クラス定義ファイルC1(図13)の記述d114より、参照先クラスはEmployeeクラスである。そして、図15に示されるオブジェクト配置定義記憶部22において、Departmentクラスに対するO/RマッパーIDと、Employeeクラスに対するO/RマッパーIDとは異なる。したがって、対象クラスのオブジェクトの永続化先と、参照先クラスのオブジェクトの永続化先とは異なると判定される。
For example, when the target class is the Department class, the reference class is the Employee class from the description d114 of the class definition file C1 (FIG. 13). In the object arrangement
対象クラスのオブジェクトの永続化先と、参照先クラスのオブジェクトの永続化先とが異なる場合(S103でYes)、変更対象選択部11は、対象クラス定義ファイルを、変更対象であると判定する(S104)。すなわち、対象クラス定義ファイルは、変更対象クラス定義ファイルとして選択される。具体的には、対象クラス定義ファイルが、変更対象クラス定義ファイルが格納されるべき所定のフォルダにコピーされてもよい。または、変更対象選択部11が、対象クラス定義ファイルに関する変更処理の実行を、クラス定義変更部12に要求してもよい。
When the persistence destination of the object of the target class is different from the persistence destination of the object of the reference class (Yes in S103), the change target selection unit 11 determines that the target class definition file is a change target ( S104). That is, the target class definition file is selected as the change target class definition file. Specifically, the target class definition file may be copied to a predetermined folder in which the change target class definition file is to be stored. Alternatively, the change target selection unit 11 may request the class
一方、対象クラスのオブジェクトの永続化先と、参照先クラスのオブジェクトの永続化先とが同じである場合(S103でNo)、変更対象選択部11は、対象クラス定義ファイルは、変更対象ではないと判定する。この場合、対象クラスのオブジェクトと参照先クラスのオブジェクトとは、単一のデータストア16に永続化され、参照整合性制約に違反することはないからである。 On the other hand, when the persistence destination of the object of the target class is the same as the persistence destination of the object of the reference class (No in S103), the change target selection unit 11 does not change the target class definition file. Is determined. In this case, the object of the target class and the object of the reference class are persisted in the single data store 16 and do not violate the referential integrity constraint.
なお、図12の処理は、クラス定義ファイル記憶部21に記憶されている各クラス定義ファイルについて実行される。したがって、複数のクラス定義ファイルが変更対象クラス定義ファイルとして選択される可能性も有る。
The process of FIG. 12 is executed for each class definition file stored in the class definition
続いて、変更対象クラス定義ファイルの変更処理について説明する。図16は、変更対象クラス定義ファイルの変更処理の処理手順の一例を説明するためのシーケンス図である。同図の処理は、図12の処理と同期的に実行されてもよいし、図12の処理と非同期に実行されてもよい。例えば、図12のステップS104において、変更対象選択部11からクラス定義変更部12に対して変更処理の実行が要求される場合、図16の処理は、そのときの対象クラス定義ファイルを処理対象として図12の処理と同期的に実行される。一方、図12のステップS104において、変更対象クラス定義ファイルが、所定のフォルダにコピーされる場合、図16の処理は、当該フォルダにコピーされた一以上の変更対象クラス定義ファイルに関してバッチ的に実行されてもよい。
Next, the change process of the change target class definition file will be described. FIG. 16 is a sequence diagram for explaining an example of the processing procedure of the change process of the change target class definition file. The process of FIG. 12 may be executed synchronously with the process of FIG. 12 or may be executed asynchronously with the process of FIG. For example, when the change target selection unit 11 requests the class
いずれの場合であっても、図16の処理は、変更対象クラス定義ファイルのロード時に実行されてもよい。変更対象クラス定義ファイルのロード時とは、変更対象クラス定義ファイルに定義されたクラスを利用する、アプリケーションプログラム17が起動されるときをいう。なお、Java(登録商標)であれば、Java(登録商標)クラスファイルがクラス定義ファイルの一例である。Java(登録商標)クラスファイルの内容は、Java(登録商標)コンパイラによってコンパイルされたバイトコードであるが、コードインジェクション機構等を利用して、ロード時に書き換え可能である。コードインジェクション機構とは、Java(登録商標)クラスファイルを入力とし、オリジナルのプログラムとは異なるプログラムを挿入したり、ロジックを変更したり、フィールド又はメソッド等のプログラム要素にアノテーションを追加したりできる機構である。
In any case, the processing in FIG. 16 may be executed when the change target class definition file is loaded. The time when the change target class definition file is loaded is when the
ステップS111において、クラス定義変更部12は、一つの変更対象クラス定義ファイルに対する変更処理を、識別属性追加部121に要求する。ここでは、Departmentクラスのクラス定義ファイルC1が変更処理の対象とされた場合を例とする。続いて、識別属性追加部121は、例えば、コードインジェクション機構を用いて、変更対象クラス定義ファイルにおける参照要素コレクションフィールドに対応する識別要素コレクションフィールドを、変更対象クラス定義ファイルに追加する(S112)。この際、識別属性追加部121は、当該識別要素コレクションフィールドのsetter及びgetterの定義も、変更対象クラス定義ファイルに追加する。
In step S <b> 111, the class
図17は、識別要素コレクションフィールドの追加後のDepartmentクラスのクラス定義ファイルの定義例を示す図である。図17中、図13と同一部分には同一符号を付し、その説明は省略する。 FIG. 17 is a diagram illustrating a definition example of the class definition file of the Department class after the identification element collection field is added. In FIG. 17, the same parts as those in FIG. 13 are denoted by the same reference numerals, and the description thereof is omitted.
図17中、記述d121、記述d122、及び記述d123が、ステップS112において追加される部分である。すなわち、記述d121に示されるemployeesIdsフィールドは、記述d114に示されるemployeesフィールドに対応する識別要素コレクションフィールドである。記述d122に示されるgetEmployeesIdsメソッドは、employeesIdsフィールドのgetterである。記述d122に示されるsetEmployeesIdsメソッドは、employeesIdsフィールドのsetterである。 In FIG. 17, description d121, description d122, and description d123 are parts added in step S112. That is, the employeesIds field shown in the description d121 is an identification element collection field corresponding to the employees field shown in the description d114. The getEmployeesIds method shown in the description d122 is a getter of the employeesIds field. The setEmployeesIds method shown in the description d122 is a setter of the employeesIds field.
なお、employeesIdフィールドの要素の型は、String型(文字列型)とされている。これは、参照先であるEmployeeクラスの識別属性の型が、String型であるからである。Employeeクラスのフィールドのうち、いずれのフィールドが識別属性であるかは、@Idアノテーションに基づいて判定される。すなわち、@Idアノテーションが付加されているフィールドが、識別属性のフィールドであると判定される。Employeeクラスのクラス定義ファイルC2(図14)では、記述d211におけるidフィールドに@Idアノテーションが付加されている。したがって、idフィールドが識別属性であると判定される。また、idフィールドの型は、String型である。したがって、employeesIdフィールドの要素の型は、String型とされる。 The element type of the employeesId field is a string type (character string type). This is because the identification attribute type of the Employee class that is the reference destination is the String type. Which of the fields of the Employee class is the identification attribute is determined based on the @Id annotation. That is, it is determined that the field to which the @Id annotation is added is a field having an identification attribute. In the class definition file C2 of the Employee class (FIG. 14), the @Id annotation is added to the id field in the description d211. Therefore, it is determined that the id field is an identification attribute. The type of the id field is a string type. Therefore, the element type of the employeesId field is a string type.
なお、仮に、図17に示される定義情報に基づいて生成されるDepartmentオブジェクトは、図6に示されるような参照関係を形成する。 Note that the Department object generated based on the definition information shown in FIG. 17 forms a reference relationship as shown in FIG.
続いて、クラス定義変更部12は、参照属性除外部122に対して、変更対象クラス定義ファイルに対する変更処理の実行を要求する(S113)。参照属性除外部122は、例えば、コードインジェクション機構を用いて、変更対象クラス定義ファイルにおける参照要素コレクションフィールドを永続化対象から除外するための定義を、変更対象クラス定義ファイルに追加する(S114)。
Subsequently, the class
続いて、クラス定義変更部12は、参照属性設定メソッド変更部123に対して、変更対象クラス定義ファイルに対する変更処理の実行を要求する(S115)。参照属性設定メソッド変更部123は、例えば、コードインジェクション機構を用いて、変更対象クラス定義ファイルにおける、参照要素コレクションフィールドのsetterの定義内容に関して変更を行う(S116)。すなわち、参照要素コレクションフィールドと、識別要素コレクションフィールドとの整合性が保持されるようにするための処理が参照要素コレクションフィールドのsetterに追加される。
Subsequently, the class
続いて、クラス定義変更部12は、参照属性取得メソッド変更部124に対して、変更対象クラス定義ファイルに対する変更処理の実行を要求する(S117)。参照属性取得メソッド変更部124は、例えば、コードインジェクション機構を用いて、変更対象クラス定義ファイルにおける、参照要素コレクションフィールドのgetterの定義内容に関して変更を行う(S118)。すなわち、参照要素コレクションフィールドと、識別要素コレクションフィールドとの整合性が保持されるようにするための処理が参照要素コレクションフィールドのgetterに追加される。
Subsequently, the class
図18は、参照要素コレクションフィールドに関して変更が行われた後のDepartmentクラスのクラス定義ファイルの定義例を示す図である。同図のクラス定義ファイルC1は、図17に示されるクラス定義ファイルC1に対して、ステップS113〜S118が実行された結果を示す。図18中、図17と同一部分には同一符号を付し、その説明は省略する。 FIG. 18 is a diagram illustrating a definition example of the class definition file of the Department class after a change has been made regarding the reference element collection field. The class definition file C1 in FIG. 16 shows the result of executing steps S113 to S118 on the class definition file C1 shown in FIG. In FIG. 18, the same parts as those in FIG.
図18では、図17における記述d114、記述d115、記述d116のそれぞれが、記述d114a、記述d115a、記述d116aに変更されている。 In FIG. 18, the description d114, the description d115, and the description d116 in FIG. 17 are changed to a description d114a, a description d115a, and a description d116a, respectively.
すなわち、記述d114aには、ステップS114の実行によって、@Transientアノテーションが付加されている。@Transientアノテーションは、当該アノテーションが付加されたフィールドを永続化対象から除外することを示す修飾子である。すなわち、O/Rマッパー部15aやO/Rマッパー部15bは、オブジェクトを永続化する際、@Transientアノテーションが付加されたフィールドを永続化対象から除外する。
That is, the @Transient annotation is added to the description d114a by executing step S114. The @Transient annotation is a qualifier indicating that the field to which the annotation is added is excluded from the persistence target. That is, the O /
また、記述d116aには、ステップS116の実行によって、下線部分が追加されている。下線部分には、図7に示される参照関係を、図8に示される参照関係に変更するための処理手順が記述されている。 In addition, an underlined portion is added to the description d116a by executing step S116. In the underlined portion, a processing procedure for changing the reference relationship shown in FIG. 7 to the reference relationship shown in FIG. 8 is described.
更に、記述d115aには、ステップS118の実行によって、下線部分が追加されている。下線部分には、employeesフィールドに連動コレクションオブジェクトへの参照が設定されている場合に、当該連動コレクションオブジェクトへの参照を返却するための処理手順が記述されている。employeesフィールドに連動コレクションオブジェクトへの参照が設定されている場合とは、図8に示される参照関係が形成されている場合をいう。また、当該下線部分には、employeesフィールドに連動コレクションオブジェクトへの参照が設定されていない場合に、図8に示される参照関係を形成して連動コレクションオブジェクトへの参照を返却するための処理手順が記述されている。なお、employeesフィールドに連動コレクションオブジェクトへの参照が設定されていない場合とは、Departmentオブジェクトが、図9に示される状態を有する場合である。 Furthermore, an underlined portion is added to the description d115a by executing step S118. The underlined portion describes a processing procedure for returning a reference to the linked collection object when a reference to the linked collection object is set in the employees field. The case where the reference to the linked collection object is set in the employees field means the case where the reference relationship shown in FIG. 8 is formed. Further, in the underlined portion, there is a processing procedure for forming a reference relationship shown in FIG. 8 and returning a reference to the linked collection object when a reference to the linked collection object is not set in the employees field. It has been described. The case where the reference to the linked collection object is not set in the employees field is a case where the Department object has the state shown in FIG.
以上でDepartmentクラスのクラス定義ファイルC1の変更処理は終了する。すなわち、図18に示されるクラス定義ファイルC1は、本実施の形態において、Departmentクラスに関する変更後クラス定義ファイルf1である。以下、図18に示されるクラス定義ファイルC1を、「変更後クラス定義ファイルf1」という。 This is the end of the modification process for the class definition file C1 of the Department class. That is, the class definition file C1 shown in FIG. 18 is the changed class definition file f1 related to the Department class in the present embodiment. Hereinafter, the class definition file C1 shown in FIG. 18 is referred to as a “modified class definition file f1”.
続いて、変更後クラス定義ファイルf1に基づいて生成されるオブジェクの永続化時に実行される処理手順について説明する。 Next, a processing procedure executed when an object generated based on the changed class definition file f1 is made permanent will be described.
図19及び図20は、オブジェクトの永続化時の処理手順の一例を説明するためのシーケンス図である。図19及び図20は、オブジェクトの永続化が行われる一つのシナリオに関する処理手順を説明するものであり、オブジェクトの永続化が常に当該処理手順によって実行されることを示すものではない。 19 and 20 are sequence diagrams for explaining an example of a processing procedure when an object is made permanent. FIG. 19 and FIG. 20 illustrate a processing procedure related to one scenario in which object persistence is performed, and does not indicate that object persistence is always executed by the processing procedure.
ステップS201において、アプリケーションプログラム17は、例えば、参照要素コレクションオブジェクトを生成する。当該参照要素コレクションオブジェクトは、例えば、アプリケーションプログラム17のローカル変数によってその参照が保持される。続いて、アプリケーションプログラム17は、一以上のEmployeeオブジェクトを生成する(S202)。当該Employeeオブジェクトは、図14に示されるラス定義ファイルC2の定義情報に基づいて生成される。
In step S201, the
続いて、アプリケーションプログラム17は、ステップS202において生成されたEmployeeオブジェクトへの参照を、ステップS201において生成された参照要素コレクションオブジェクトの要素として追加する。続いて、アプリケーションプログラム17は、Departmentオブジェクトを生成する(S204)。当該Dpartmentブジェクトは、変更後クラス定義ファイルf1(図18)の定義情報に基づいて生成される。
Subsequently, the
続いて、アプリケーションプログラム17は、Departmentオブジェクトのemployeesフィールドのsetterである、setEmployeesメソッドを呼び出す(S205)。setEmployeesメソッドの引数には、参照要素コレクションオブジェクトが指定される。
Subsequently, the
続いて、Departmentオブジェクトは、呼び出されたsetEmployeesメソッド内において、図18の記述d116aに定義された処理を実行する。すなわち、Departmentオブジェクトは、連動コレクションオブジェクトの生成を、連動コレクションオブジェクト生成部13に要求する(S206)。当該要求には、setEmployeesメソッドの引数に指定された参照要素コレクションオブジェクトが指定される。
Subsequently, the Department object executes the process defined in the description d116a of FIG. 18 in the called setEmployees method. That is, the Department object requests the linked collection
続いて、連動コレクションオブジェクト生成部13は、連動コレクションオブジェクトを生成する(S207)。続いて、連動コレクションオブジェクト生成部13は、識別要素コレクションオブジェクトを生成する(S208)。この時点において、生成された各オブジェクトの状態は、例えば、図21に示される通りである。
Subsequently, the linked collection
図21は、各オブジェクトの状態の例を示す第一の図である。同図に示されるように、ステップS208の直後においては、Departmentオブジェクト、参照要素コレクションオブジェクト、Employeeオブジェクト、連動コレクションオブジェクト、及び識別要素コレクションオブジェクトが生成されている。各Employeeオブジェクトは、参照要素コレクションオブジェクトの要素として追加されている。したがって、参照要素コレクションオブジェクトは、各Employeeオブジェクトを参照している。他のオブジェクト間には参照関係は形成されていない。また、識別要素コレクションオブジェクトには、要素は追加されていない。 FIG. 21 is a first diagram illustrating an example of the state of each object. As shown in the figure, immediately after step S208, a Department object, a reference element collection object, an Employee object, a linked collection object, and an identification element collection object are generated. Each Employee object is added as an element of a reference element collection object. Therefore, the reference element collection object refers to each Employee object. No reference relationship is formed between other objects. In addition, no element is added to the identification element collection object.
続いて、連動コレクションオブジェクト生成部13は、参照要素コレクションオブジェクトの要素である各Employeeオブジェクトから、idフィールドの値(識別属性の値)を取得する(S209)。続いて、連動コレクションオブジェクト生成部13は、取得された各idフィールドの値を、識別要素コレクションオブジェクトに追加する(S210)。その結果、各オブジェクトの状態は、例えば、図22に示されるようになる。
Subsequently, the linked collection
図22は、各オブジェクトの状態の例を示す第二の図である。同図に示されるように、ステップS210が実行されることにより、識別要素コレクションオブジェクトには、各Employeeオブジェクトのidフィールドの値が要素として追加されている。 FIG. 22 is a second diagram illustrating an example of the state of each object. As shown in the figure, by executing Step S210, the value of the id field of each Employee object is added as an element to the identification element collection object.
続いて、連動コレクションオブジェクト生成部13は、連動コレクションオブジェクトのvalsフィールドに、参照要素コレクションオブジェクトへの参照を設定(代入)する。また、連動コレクションオブジェクト生成部13は、連動コレクションオブジェクトのidsフィールドに、識別要素コレクションオブジェクトへの参照を設定(代入)する(S211)。その結果、各オブジェクトの状態は、例えば、図23に示されるようになる。
Subsequently, the linked collection
図23は、各オブジェクトの状態の例を示す第三の図である。同図に示されるように、ステップS211の実行により、連動コレクションオブジェクトから識別要素コレクションオブジェクト及び参照要素コレクションオブジェクトへの参照関係が形成されている。なお、図23に示される状態で、連動コレクションオブジェクトへの参照が、setEmployeesメソッドの戻り値として、連動コレクションオブジェクト生成部13からDepartmentオブジェクトへ返却される。
FIG. 23 is a third diagram illustrating an example of the state of each object. As shown in the figure, a reference relationship from the linked collection object to the identification element collection object and the reference element collection object is formed by executing step S211. In the state shown in FIG. 23, a reference to the linked collection object is returned from the linked collection
続いて、Departmentオブジェクトは、参照要素コレクションフィールドであるemployeesフィールドに、連動コレクションオブジェクトへの参照を代入する。また、Departmentオブジェクトは、識別要素コレクションフィールドであるemployeesIdsフィールドに、連動コレクションオブジェクトのvalsフィールドの値、すなわち、識別要素コレクションオブジェクトへの参照を代入する(S212)。その結果、各オブジェクトの状態は、図8において説明した通りとなる。 Subsequently, the Department object assigns a reference to the linked collection object to the employees field that is a reference element collection field. In addition, the Department object substitutes the value of the vals field of the linked collection object, that is, the reference to the identification element collection object, in the employeesIds field that is the identification element collection field (S212). As a result, the state of each object is as described in FIG.
以上で、ステップS205において呼び出された、setEmployeesメソッドの処理は終了する。すなわち、ステップS205〜S212までが、図18の記述d116aに定義された処理である。setEmployeesメソッドの処理の終了結果、処理の制御は、アプリケーションプログラム17に復帰する。
Above, the process of the setEmployees method called in step S205 ends. That is, steps S205 to S212 are the processes defined in the description d116a in FIG. As a result of the completion of the process of the setEmployees method, the control of the process returns to the
続いて、アプリケーションプログラム17は、O/Rマッパーアクセス部14に、トランザクションの開始を要求する(図20:S213)。当該トランザクションは、Departmentオブジェクト及びEmployeeオブジェクト等をデータストア16a又はデータストア16bに永続化するためのトランザクションである。
Subsequently, the
続いて、O/Rマッパーアクセス部14は、O/Rマッパー部15a及びO/Rマッパー部15bのそれぞれに、トランザクションの開始を要求する(S214、S215)。続いて、アプリケーションプログラム17は、O/Rマッパーアクセス部14に、各Employeeオブジェクトの永続化を要求する(S216)。O/Rマッパーアクセス部14は、例えば、オブジェクト配置定義記憶部22を参照して、Employeeオブジェクトに対応するO/Rマッパー部15はO/Rマッパー部15bであると判定する。そこで、O/Rマッパーアクセス部14は、各Employeeオブジェクトの永続化をO/Rマッパー部15bに要求する(S217)。
Subsequently, the O / R
続いて、アプリケーションプログラム17は、O/Rマッパーアクセス部14に、Departmentオブジェクトの永続化を要求する(S218)。O/Rマッパーアクセス部14は、例えば、オブジェクト配置定義記憶部22を参照して、Departmentオブジェクトに対応するO/Rマッパー部15はO/Rマッパー部15aであると判定する。そこで、O/Rマッパーアクセス部14は、Departmentオブジェクトの永続化をO/Rマッパー部15aに要求する(S217)。
Subsequently, the
続いて、アプリケーションプログラム17は、トランザクションのコミット(トランザクションの内容のデータストア16への反映)をO/Rマッパーアクセス部14に要求する(S220)。O/Rマッパーアクセス部14は、O/Rマッパー部15a及びO/Rマッパー部15bのそれぞれに対し、にトランザクションのコミットを要求する(S221、S222)。その結果、O/Rマッパー部15bによって、各Employeeオブジェクトは、データストア16bのレコードに変換されて永続化される。また、O/Rマッパー部15aによって、Departmentオブジェクトは、データストア16aのレコードに変換されて永続化される。但し、Departmentオブジェクトの参照要素コレクションフィールドであるemployeesフィールドは、変更後クラス定義ファイルf1(図18)の記述d114aの@Transientアノテーションに基づいて、永続化対象から除外される。
Subsequently, the
ステップS222の実行直後において、各データストア16aには、例えば、図24に示されるように、Departmentオブジェクト及びEmployeeオブジェクトが永続化される。
Immediately after the execution of step S222, for example, as shown in FIG. 24, a Department object and an Employee object are made permanent in each
図24は、Departmentオブジェクト及びEmployeeオブジェクトの永続化状態の例を示す図である。 FIG. 24 is a diagram illustrating an example of the persistence state of the Department object and the Employee object.
同図において、データストア16bには、図5に示される状態の各Employeeオブジェクトが永続化された例が示されている。すなわち、二つのEmployeeオブジェクトのそれぞれに対応するレコードが、データストア16bのレコードに生成されている。また、二つのEmployeeオブジェクトのidフィールド及びnameフィールドの値が、各レコードの項目の値として永続化されている。
In the figure, the
また、データストア16aには、図5に示される状態のDepartmentオブジェクトが永続化された例が示されている。すなわち、当該Departmentオブジェクトに対応するレコードが、データストア16aに生成されている。また、当該Departmentオブジェクトのidフィールド及びemployeesIdsフィールドの値が、当該レコードの項目として永続化されている。なお、employeesIdsフィールドについては、識別要素コレクションオブジェクトの要素である各文字列オブジェクト値が、永続化されている。
The
O/Rマッパー部15aやデータストア16aから見た場合、employeesIdsフィールドの値は、単なる文字列の集合であり、他のオブジェクトへの参照としての意味を有さない。また、上記したように、参照要素コレクションフィールドであるemploeesフィールドは、永続化の対象とはされない。したがって、参照整合性制約に違反することなく、かつ、employeesIdsフィールドの値によってEmployeeオブジェクトへの参照関係が維持されたまま、Departmentオブジェクトを永続化することができる。
When viewed from the O /
続いて、永続化されているオブジェクトの取得時に実行される処理手順について説明する。 Next, a processing procedure executed when acquiring a persistent object will be described.
図25〜図27は、永続化されているオブジェクトの取得時の処理手順の一例を説明するためのシーケンス図である。図25〜図27は、オブジェクトの取得が行われる一つのシナリオに関する処理手順を説明するものであり、オブジェクトの取得が常に当該処理手順によって実行されることを示すものではない。 FIG. 25 to FIG. 27 are sequence diagrams for explaining an example of a processing procedure when acquiring a permanent object. FIGS. 25 to 27 illustrate a processing procedure related to one scenario in which object acquisition is performed, and does not indicate that object acquisition is always executed by the processing procedure.
ステップS301において、アプリケーションプログラム17は、トランザクションの開始をO/Rマッパーアクセス部14に要求する。当該トランザクションは、Departmentオブジェクト及びEmployeeオブジェクト等をデータストア16a又はデータストア16bより取得するためのトランザクションである。
In step S301, the
続いて、O/Rマッパーアクセス部14は、O/Rマッパー部15a及びO/Rマッパー部15bのそれぞれに、トランザクションの開始を要求する(S302、S303)。
Subsequently, the O / R
続いて、アプリケーションプログラム17は、Departmentオブジェクトの取得をO/Rマッパーアクセス部14に要求する(S304)。当該要求には、取得対象のDepartmentオブジェクトを特定するための情報として、idフィールドの値が指定される。例えば、idフィールドの値が”人事部”であるDepartmentオブジェクトの取得が要求される。
Subsequently, the
O/Rマッパーアクセス部14は、例えば、オブジェクト配置定義記憶部22を参照して、Departmentオブジェクトに対応するO/Rマッパー部15はO/Rマッパー部15aであると判定する。そこで、O/Rマッパーアクセス部14は、O/Rマッパー部15aに、idフィールドの値が”人事部”であるDepartmentオブジェクトの取得を要求する(S305)。
For example, the O / R
続いて、O/Rマッパー部15aは、id項目の値が”人事部”であるレコードをデータストア16aより検索し、当該レコード(図24)に基づいて、idフィールドの値が”人事部”であるDepartmentオブジェクトを生成する(S306)。続いて、O/Rマッパー部15aは、当該レコードのemployeesIds項目の値を格納するための識別要素コレクションオブジェクトを生成する(S307)。続いて、O/Rマッパー部15aは、当該レコードのemployeesIds項目に記憶されている各文字列に対応する文字列オブジェクトを、当該DepartmentオブジェクトのemployeesIdsフィールドの要素として追加する(S308)。なお、ステップS308の実行直後のDepartmentオブジェクトの状態は、例えば、図9に示した通りである。図9に示される状態のDepartmentオブジェクトが、O/Rマッパーアクセス部14を介して、アプリケーションプログラム17に返却される。その結果、処理の制御は、アプリケーションプログラム17に復帰する。
Subsequently, the O /
続いて、アプリケーションプログラム17が、当該DepartmentオブジェクトのemployeeIdsフィールドに関するgetterである、getEmployeesを呼び出したとする(図26:S309)。Departmentオブジェクトは、呼び出されたgetEmployeesメソッド内において、図18の記述d115aに定義された処理を実行する。
Subsequently, it is assumed that the
すなわち、Departmentオブジェクトは、連動コレクションオブジェクトの生成を連動コレクションオブジェクト生成部13に要求する(S310)。当該要求には、employeesIdsフィールドに設定されている識別要素コレクションオブジェクトへの参照が引数として指定される。
That is, the Department object requests the linked collection
続いて、連動コレクションオブジェクト生成部13は、連動コレクションオブジェクトを生成する(S311)。続いて、連動コレクションオブジェクト生成部13は、参照要素コレクションオブジェクトを生成する(S312)。続いて、連動コレクションオブジェクト生成部13は、引数に指定された識別要素コレクションオブジェクトの各要素である文字列(すなわち、Employeeオブジェクトのidフィールドの値)を取得する(S313)。
Subsequently, the linked collection
続いて、連動コレクションオブジェクト生成部13は、取得された文字列をidフィールドの値とするEmployeeオブジェクトの取得を、O/Rマッパーアクセス部14に要求する(S314)。O/Rマッパーアクセス部14は、例えば、オブジェクト配置定義記憶部22を参照して、Employeeオブジェクトに対応するO/Rマッパー部15はO/Rマッパー部15bであると判定する。そこで、O/Rマッパーアクセス部14は、O/Rマッパー部15bに、当該文字列をidフィールドの値とするEmployeeオブジェクトの取得を要求する(S315)。
Subsequently, the linked collection
続いて、O/Rマッパー部15bは、id項目の値が当該文字列と一致するレコードをデータストア16bより検索し、当該レコード(図24)に基づいて、idフィールドの値が当該文字列であるEmployeeオブジェクトを生成する(S316)。なお、ステップS314〜S316は、ステップS313において取得された文字列の数だけ実行される。その結果、当該文字列の数だけEmployeeオブジェクトが生成される。
Subsequently, the O /
続いて、連動コレクションオブジェクト生成部13は、生成された各Employeeオブジェクトを、参照要素コレクションオブジェクトの要素として追加する(S317)。この時点で、各オブジェクトの状態は、例えば、図28に示されるようになる。
Subsequently, the linked collection
図28は、各オブジェクトの状態の例を示す第四の図である。同図に示されるように、図25の処理によって取得されたDepartmentオブジェクトに加え、連動コレクションオブジェクト、参照要素コレクションオブジェクトが生成されている。また、各Employeeオブジェクが、データストア16bより取得され、参照要素コレクションオブジェクトの要素とされている。
FIG. 28 is a fourth diagram illustrating an example of the state of each object. As shown in the figure, in addition to the Department object acquired by the processing of FIG. 25, a linked collection object and a reference element collection object are generated. Each Employee object is acquired from the
なお、連動コレクションオブジェクト生成部13は、ステップS314のタイミングで、データストア16bからのEmployeeオブジェクトの取得をおこなわなくてもよい。その後に連動コレクションオブジェクトに対してEmployeeオブジェクトの取得が要求された際に、データストア16bからEmployeeオブジェクトが取得されてもよい。
Note that the linked collection
続いて、連動コレクションオブジェクト生成部13は、連動コレクションオブジェクトのvalsフィールドに、参照要素コレクションオブジェクトへの参照を代入する。また、連動コレクションオブジェクト生成部13は、連動コレクションオブジェクトのidsフィールドに、識別要素コレクションオブジェクトへの参照を代入する(S318)。その結果、各オブジェクトの状態は、例えば、図29に示されるようになる。
Subsequently, the linked collection
図29は、各オブジェクトの状態の例を示す第五の図である。同図に示されるように、ステップS318の実行により、連動コレクションオブジェクトから識別要素コレクションオブジェクト及び参照要素コレクションオブジェクトへの参照関係が形成されている。なお、図29に示される状態で、連動コレクションオブジェクトへの参照が、連動コレクションオブジェクト生成部13からDepartmentオブジェクトへ返却される。
FIG. 29 is a fifth diagram illustrating an example of the state of each object. As shown in the figure, the reference relationship from the linked collection object to the identification element collection object and the reference element collection object is formed by executing step S318. Note that, in the state shown in FIG. 29, a reference to the linked collection object is returned from the linked collection
続いて、Departmentオブジェクトは、参照要素コレクションフィールドであるemployeesフィールドに、連動コレクションオブジェクトへの参照を代入する(S319)。その結果、各オブジェクトの状態は、図8において説明した通りとなる。なお、図8に示される状態の連動コレクションオブジェクトへの参照が、ステップS309において呼び出されたgetEmployeesの戻り値として、アプリケーションプログラム17に返却される。すなわち、ステップS310〜S319までが、図18の記述115aに定義された処理である。
Subsequently, the Department object assigns a reference to the linked collection object to the employees field that is a reference element collection field (S319). As a result, the state of each object is as described in FIG. A reference to the linked collection object in the state shown in FIG. 8 is returned to the
続いて、アプリケーションプログラム17は、トランザクションのコミットをO/Rマッパーアクセス部14に要求する(S320)。O/Rマッパーアクセス部14は、O/Rマッパー部15a及びO/Rマッパー部15bのそれぞれに対し、にトランザクションのコミットを要求する(S321、S322)。
Subsequently, the
このように、Departmentオブジェクトの参照要素コレクションフィールドが永続化の対象から除外されたとしても、識別要素コレクションフィールドに基づいて、DepartmentオブジェクトとEmployeeオブジェクトとの参照関係を復元することができる。 As described above, even when the reference element collection field of the Department object is excluded from the target of persistence, the reference relationship between the Department object and the Employee object can be restored based on the identification element collection field.
続いて、ダーティチェック時に実行される処理手順について説明する。ダーティチェック時に実行される処理手順とは、Departmentオブジェクト又はEmployeeオブジェクトに対する変更内容がデータストア16a又はデータストア16bへ反映される際に実行される処理手順である。
Next, a processing procedure executed at the dirty check will be described. The processing procedure executed at the time of the dirty check is a processing procedure executed when a change content for the Department object or the Employee object is reflected in the
図30及び図31は、ダーティチェック時に実行される処理手順の一例を説明するためのシーケンス図である。図30及び図31は、ダーティチェックが行われる一つのシナリオに関する処理手順を説明するものであり、ダーティチェックが常に当該処理手順によって実行されることを示すものではない。なお、図30に示される処理手順の前に、図25及び図26において説明した処理手順(S301〜S319)が実行され、図8に示される状態の連動レコクションオブジェクトがアプリケーションプログラム17に返却されていることとする。 30 and 31 are sequence diagrams for explaining an example of a processing procedure executed at the time of the dirty check. FIG. 30 and FIG. 31 illustrate a processing procedure related to one scenario in which a dirty check is performed, and does not indicate that the dirty check is always executed by the processing procedure. Before the processing procedure shown in FIG. 30, the processing procedure (S301 to S319) described in FIG. 25 and FIG. 26 is executed, and the linked recovery object in the state shown in FIG. Suppose that
ステップS319に続いて、アプリケーションプログラム17は、DepartmentオブジェクトのgetEmployeesメソッドの戻り値として返却された連動コレクションオブジェクトを、ローカル変数に代入する(S420)。その結果、図8に示される各オブジェクトの状態は、図32に示されるものへ変化する。
Subsequent to step S319, the
図32は、各オブジェクトの状態の例を示す第六の図である。同図では、連動コレクションオブジェクトへの参照が、ローカル変数に代入されている状態が示されている。 FIG. 32 is a sixth diagram illustrating an example of the state of each object. In the figure, a state in which the reference to the linked collection object is assigned to the local variable is shown.
なお、アプリケーションプログラム17(の開発者)は、getEmployeesメソッドの戻り値が連動コレクションオブジェクトであることは意識していない。すなわち、getEmployeesメソッドは、Departmentオブジェクトにおける参照要素コレクションフィールドのgetterである。したがって、アプリケーションプログラム17(の開発者)は、getEmployeesメソッドの戻り値を、参照要素コレクションオブジェクトへの参照として扱う。 Note that the application program 17 (developer) is not aware that the return value of the getEmployees method is a linked collection object. That is, the getEmployees method is a getter of the reference element collection field in the Department object. Therefore, the application program 17 (the developer) handles the return value of the getEmployees method as a reference to the reference element collection object.
続いて、アプリケーションプログラム17は、Employeeオブジェクトを新たに生成する(S421)。続いて、アプリケーションプログラム17は、生成されたEmployeeオブジェクトへの参照が代入されたローカル変数を指定して、連動コレクションオブジェクトに対して当該Employeeオブジェクトの追加を要求する(S422)。
Subsequently, the
続いて、連動コレクションオブジェクトは、追加要求に指定されたローカル変数に格納されているEmployeeオブジェクトへの参照を、当該連動コレクションオブジェクトのvalsフィールドに設定されている参照要素コレクションオブジェクトの要素として追加する(S423)。続いて、連動コレクションオブジェクトは、当該Employeeオブジェクトのidフィールドの値を、当該連動コレクションオブジェクトのidsフィールドに設定されている識別要素コレクションオブジェクトの要素として追加する(S424)。 Subsequently, the linked collection object adds a reference to the Employee object stored in the local variable specified in the addition request as an element of the reference element collection object set in the vals field of the linked collection object ( S423). Subsequently, the linked collection object adds the value of the id field of the employee object as an element of the identification element collection object set in the ids field of the linked collection object (S424).
上記の処理の結果、各オブジェクトの状態は、図32に示されるものから図33に示されるものへと変化する。 As a result of the above processing, the state of each object changes from that shown in FIG. 32 to that shown in FIG.
図33は、各オブジェクトの状態の例を示す第七の図である。同図では、参照要素コレクションオブジェクトの要素に、新たに生成された、idフィールドの値が「500」であるEmployeeオブジェクトへの参照が追加されている。また、当該Employeeオブジェクトのidフィールドの値を示す文字列オブジェクトが、識別要素コレクションオブジェクトの要素として追加されている。その結果、参照要素コレクションオブジェクトと識別要素コレクションオブジェクトとの整合性が維持されている。 FIG. 33 is a seventh diagram illustrating an example of the state of each object. In the drawing, a reference to the newly generated Employee object whose id field value is “500” is added to the element of the reference element collection object. In addition, a character string object indicating the value of the id field of the Employee object is added as an element of the identification element collection object. As a result, the consistency between the reference element collection object and the identification element collection object is maintained.
続いて、アプリケーションプログラム17は、新たに生成されたEmployeeオブジェクトの永続化をO/Rマッパーアクセス部14に要求する(図31:S425)。O/Rマッパーアクセス部14は、例えば、オブジェクト配置定義記憶部22を参照して、Employeeオブジェクトに対応するO/Rマッパー部15はO/Rマッパー部15bであると判定する。そこで、O/Rマッパーアクセス部14は、当該Employeeオブジェクトの永続化をO/Rマッパー部15bに要求する(S426)。
Subsequently, the
続いて、アプリケーションプログラム17は、トランザクションのコミットをO/Rマッパーアクセス部14に要求する(S427)。O/Rマッパーアクセス部14は、O/Rマッパー部15a及びO/Rマッパー部15bのそれぞれに対し、にトランザクションのコミットを要求する(S428、S430)。
Subsequently, the
この際、O/Rマッパー部15aによるコミットの実行時に、DepartmentオブジェクトのemployeeIdsフィールドに関して、データストア16aの内容との差分が検出される。すなわち、employeeIdsフィールドに設定されている識別要素コレクションオブジェクトに新たに追加されたidフィールドの値(「500」)が、差分として検出される。そこで、O/Rマッパー部15aは、当該差分をデータストア16aに反映させる。すなわち、データストア16aにおいて、id項目の値が”人事部”であるレコードのemployeesIds項目に、当該差分である値(「500」)が追加される。O/Rマッパー部15aによるこのような処理は、ダーティチェックと呼ばれるO/Rマッパー部15の標準的な機能で実現可能である。
At this time, when the O /
その結果、Departmentオブジェクト及びEmployeeオブジェクトの永続化状態は、例えば、図24に示されるものから図34に示されるものへ変化する。 As a result, the persistence state of the Department object and the Employee object changes from the one shown in FIG. 24 to the one shown in FIG. 34, for example.
図34は、ダーティチェック後のDepartmentオブジェクト及びEmployeeオブジェクトの永続化状態の例を示す図である。 FIG. 34 is a diagram illustrating an example of the persistence state of the Department object and the Employee object after the dirty check.
同図では、データストア16aにおける、idの値が”人事部”であるDepartmentオブジェクト対応するレコードのemployeesIds項目に対して、”500”が追加されている。また、データストア16bに、id項目の値が”500”であるEmployeeオブジェクトに対応するレコードが追加されている。
In the figure, “500” is added to the “employeesIds” item of the record corresponding to the Department object whose id value is “HR” in the
このように、本実施の形態では、参照要素コレクションオブジェクトの代わりに連動コレクションオブジェクトをアプリケーションプログラム17の操作対象とすることにより、参照要素コレクションオブジェクトと識別要素コレクションオブジェクトとの整合性を維持することができる。その結果、ダーティチェックを有効に機能させることができる。
As described above, in the present embodiment, the consistency between the reference element collection object and the identification element collection object can be maintained by using the linked collection object as the operation target of the
なお、本実施の形態では、便宜上、DepartmentオブジェクトからEmployeeオブジェクトへの片方向の一対多の参照関係に関して説明したが、本実施の形態は、双方向の一対多の参照関係、又は双方向の多対多の参照関係に関しても適用可能である。 In this embodiment, for the sake of convenience, a one-to-many reference relationship from a Department object to an Employee object has been described. It can also be applied to the reference relationship.
上述したように、本実施の形態によれば、片方向一対多、双方向1対多、又は双方向多対多等の参照関係を有し、相互に永続化先が異なるオブジェクト群について、参照整合性制約に違反することなく、かつ、当該参照関係を維持した状態で、永続化を行うことができる。換言すれば、オブジェクト間の参照関係を複数のデータストアに跨って永続化することができる。 As described above, according to the present embodiment, reference matching is performed on object groups having different reference destinations such as one-way one-to-many, bidirectional one-to-many, or bidirectional many-to-many. Persistence can be performed without violating the sex constraint and maintaining the reference relationship. In other words, the reference relationship between objects can be made persistent across a plurality of data stores.
また、参照先のクラス(例えば、Employeeクラス)のオブジェクトを参照する参照元のクラス(例えば、Departmentクラス)の参照要素コレクションフィールドのsetterに関して、参照要素コレクションフィールドと識別要素コレクションフィールドとの整合性が維持されるようにクラス定義ファイルが自動的に変更される。したがって、当該setterの呼び出しに応じて、参照要素コレクションフィールドと識別要素コレクションフィールドとの間に不整合が発生するのを回避することができる。 In addition, regarding the set of the reference element collection field of the reference source class (for example, Department class) that refers to the object of the reference class (for example, the Employee class), the consistency between the reference element collection field and the identification element collection field is The class definition file is automatically changed so that it is maintained. Therefore, it is possible to avoid inconsistency between the reference element collection field and the identification element collection field in response to the call to the setter.
また、参照要素コレクションフィールドと識別要素コレクションフィールドとの整合性を維持するために連動コレクションオブジェクトが導入され、参照要素コレクションフィールドのgetterでは、連動コレクションオブジェクトが返却される。そして、連動コレクションオブジェクトは、参照元のオブジェクト参照要素コレクションオブジェクトと、識別要素コレクションオブジェクトとを参照する。このことは、連動コレクションオブジェクトは、実質的に、参照元のオブジェクトの参照コレクションフィールド及び識別要素コレクションフィールドを参照することを意味する。更に、連動コレクションオブジェクトは、参照要素コレクションオブジェクトと同じインタフェース(Listインタフェース)を実装し、当該インタフェースを介したオブジェクトの追加又は削除等を、参照元のオブジェクトの参照要素コレクションオブジェクト及び識別要素コレクションオブジェクトに反映する。すなわち、当該インタフェースを介したオブジェクトの追加又は削除等は、参照元のオブジェクトの参照要素コレクションフィールド及び識別要素コレクションフィールドに反映される。したがって、当該参照要素コレクションフィールドのgetterの戻り値がローカル変数等に代入された場合であっても、当該ローカル変数を介して行われる参照要素コレクションオブジェクトに関する変更要求を、参照元のオブジェクトの参照要素コレクションフィールド及び子識別要素コレクションフィールドの双方に反映させることができる。 Also, a linked collection object is introduced to maintain the consistency between the reference element collection field and the identification element collection field, and the linked collection object is returned in the getter of the reference element collection field. Then, the linked collection object refers to the reference source object reference element collection object and the identification element collection object. This means that the linked collection object substantially refers to the reference collection field and the identification element collection field of the reference source object. Further, the linked collection object implements the same interface (List interface) as the reference element collection object, and adds or deletes an object through the interface to the reference element collection object and the identification element collection object of the reference source object. reflect. That is, addition or deletion of an object through the interface is reflected in the reference element collection field and the identification element collection field of the reference source object. Therefore, even if the return value of the getter of the reference element collection field is assigned to a local variable or the like, a change request regarding the reference element collection object made through the local variable is sent to the reference element of the reference source object. It can be reflected in both the collection field and the child identification element collection field.
なお、本実施の形態において、連動コレクションオブジェクトへの参照は、参照元のオブジェクト(Departmentオブジェクト)の参照要素コレクションフィールドに設定(代入)される例を示した。しかし、連動コレクションオブジェクトへの参照は、必ずしも参照要素コレクションフィールドに設定されなくてもよい。例えば、連動コレクションオブジェクトへの参照が設定されるフィールド(以下、「連動コレクションフィールド」という。)が、参照元のオブジェクトのクラスに別途追加されてもよい。この場合、参照要素コレクションフィールドのgetter内においては、連動コレクションフィールドに設定されている連動コレクションオブジェクトを返却するようにすればよい。 In the present embodiment, an example is shown in which the reference to the linked collection object is set (assigned) to the reference element collection field of the reference source object (Department object). However, the reference to the linked collection object is not necessarily set in the reference element collection field. For example, a field in which a reference to a linked collection object is set (hereinafter referred to as “linked collection field”) may be added separately to the class of the reference source object. In this case, in the getter of the reference element collection field, the linked collection object set in the linked collection field may be returned.
但し、連動コレクションフィールドを設ける場合、クラス定義ファイルの変更に関して、連動コレクションフィールドを追加する処理が必要とされる。また、参照要素コレクションフィールに加えて、連動コレクションフィールドも永続化対象から除去するようにする必要がある。すなわち、クラス定義ファイルに対する変更箇所が増加するという不都合がある。また、連動コレクションフィールドのデータサイズ分だけオブジェクトのデータサイズが大きくなってしまうというという不都合もある。 However, when a linked collection field is provided, a process for adding a linked collection field is required for changing the class definition file. In addition to the reference element collection field, it is necessary to remove the linked collection field from the persistence target. That is, there is an inconvenience that the number of changes to the class definition file increases. Another disadvantage is that the data size of the object increases by the data size of the linked collection field.
一方、本実施の形態のように、参照要素コレクションフィールドに連動コレクションオブジェクトへの参照が設定される形態では、上記のような不都合はない。したがって、このような点において、参照要素コレクションフィールドに連動コレクションオブジェクトへの参照が設定される形態は、優れているといえる。 On the other hand, in the embodiment in which the reference to the linked collection object is set in the reference element collection field as in the present embodiment, there is no inconvenience as described above. Therefore, in this respect, it can be said that the form in which the reference to the linked collection object is set in the reference element collection field is excellent.
また、本実施の形態によって得られる他の効果として、複数のデータストアを跨いだ参照関係の永続化が可能となることにより、積極的に複数データストアの再構成を行なえることが挙げられる。したがって、各々の構成のパフォーマンスを計測し、最適な構成を発見するための作業が容易になることが期待できる。 Further, as another effect obtained by the present embodiment, it is possible to positively reconfigure a plurality of data stores by making it possible to perpetuate a reference relationship across a plurality of data stores. Therefore, it can be expected that the work for measuring the performance of each configuration and finding the optimal configuration will be facilitated.
また、KVSのように、本来であれば参照関係を管理できない非関係データストアであっても、RDB等の関係データストアのように使用することができるといった、非関係データストアの適用範囲の拡大への貢献も期待できる。 Further, the application range of non-relevant data stores such as KVS that can be used like a relational data store such as RDB even if it is a non-relevant data store that cannot originally manage a reference relationship can be expanded. We can expect to contribute to
なお、本実施の形態において、Departmentクラスは、第一のクラスの一例である。Employeeクラスは、第二のクラスの一例である。クラス定義ファイルは、第一のクラスの定義情報の一例である。参照属性除外部122は、除外部の一例である。識別属性追加部121は、追加部の一例である。参照属性設定メソッド変更部123は、第一の変更部の一例である。参照属性取得メソッド変更部124は、第二の変更部の一例である。連動コレクションオブジェクトは、連動オブジェクトの一例である。
In the present embodiment, the Department class is an example of a first class. The Employee class is an example of a second class. The class definition file is an example of first class definition information. The reference
以上、本発明の実施例について詳述したが、本発明は斯かる特定の実施形態に限定されるものではなく、特許請求の範囲に記載された本発明の要旨の範囲内において、種々の変形・変更が可能である。 As mentioned above, although the Example of this invention was explained in full detail, this invention is not limited to such specific embodiment, In the range of the summary of this invention described in the claim, various deformation | transformation・ Change is possible.
以上の説明に関し、更に以下の項を開示する。
(付記1)
第一のクラスの属性のうち、第二のクラスのオブジェクトの集合である第一の属性が、永続化対象から除外されるように前記第一のクラスの定義情報を変更する除外部と、
前記第二のクラスのオブジェクトの識別属性の値の集合である第二の属性を前記定義情報に追加する追加部と、
前記第一の属性に対する前記第二のクラスのオブジェクトの集合の設定要求に応じた処理について、当該集合に含まれるそれぞれの前記第二のクラスのオブジェクトの前記識別属性の値の集合を前記第二の属性に設定するように、前記定義情報を変更する第一の変更部と、
前記第一の属性の取得要求に応じた処理について、前記第一の属性に対する変更要求を前記第一の属性及び前記第二の属性に反映させる連動オブジェクトを返却するように、前記定義情報を変更する第二の変更部とを有する情報処理装置。
(付記2)
前記第一の変更部は、前記第一の属性に対する前記第二のクラスのオブジェクトの集合の設定要求に応じた処理について、当該集合と当該集合に含まれるそれぞれの前記第二のクラスのオブジェクトの前記識別属性の値の集合とを、前記連動オブジェクトに参照させ、前記連動オブジェクトを前記第一の属性に設定するように前記定義情報を変更し、
前記連動オブジェクトは、前記第一の属性に対する変更要求に応じ、当該連動オブジェクトが参照する前記第二のクラスのオブジェクトの集合及び前記識別属性の値の集合を変更する付記1記載の情報処理装置。
(付記3)
前記第二の変更部は、前記第一の属性の取得要求に応じた処理について、前記第一の属性に前記連動オブジェクトが設定されている場合は、当該連動オブジェクトを返却し、前記第一の属性に前記連動オブジェクトが設定されていない場合は、前記第二の属性に設定されている前記識別属性の値の集合に対応する前記第二のクラスのオブジェクトの集合を永続化先より取得し、取得された該集合を前記連動オブジェクトに参照させ、該連動オブジェクトを返却するように、前記定義情報を変更する付記2記載の情報処理装置。
(付記4)
第一のクラスの属性のうち、第二のクラスのオブジェクトの集合である第一の属性が、永続化対象から除外されるように前記第一のクラスの定義情報を変更し、
前記第二のクラスのオブジェクトの識別属性の値の集合である第二の属性を前記定義情報に追加し、
前記第一の属性に対する前記第二のクラスのオブジェクトの集合の設定要求に応じた処理について、当該集合に含まれるそれぞれの前記第二のクラスのオブジェクトの前記識別属性の値の集合を前記第二の属性に設定するように、前記定義情報を変更し、
前記第一の属性の取得要求に応じた処理について、前記第一の属性に対する変更要求を前記第一の属性及び前記第二の属性に反映させる連動オブジェクトを返却するように、前記定義情報を変更する処理をコンピュータが実行する情報処理方法。
(付記5)
前記第一の属性に対する前記第二のクラスのオブジェクトの集合の設定要求に応じた処理について変更する処理は、当該集合と当該集合に含まれるそれぞれの前記第二のクラスのオブジェクトの前記識別属性の値の集合とを、前記連動オブジェクトに参照させ、前記連動オブジェクトを前記第一の属性に設定するように前記定義情報を変更し、
前記連動オブジェクトは、前記第一の属性に対する変更要求に応じ、当該連動オブジェクトが参照する前記第二のクラスのオブジェクトの集合及び前記識別属性の値の集合を変更する付記4記載の情報処理方法。
(付記6)
前記第一の属性の取得要求に応じた処理について変更する処理は、前記第一の属性に前記連動オブジェクトが設定されている場合は、当該連動オブジェクトを返却し、前記第一の属性に前記連動オブジェクトが設定されていない場合は、前記第二の属性に設定されている前記識別属性の値の集合に対応する前記第二のクラスのオブジェクトの集合を永続化先より取得し、取得された該集合を前記連動オブジェクトに参照させ、該連動オブジェクトを返却するように、前記定義情報を変更する付記5記載の情報処理方法。
(付記7)
第一のクラスの属性のうち、第二のクラスのオブジェクトの集合である第一の属性が、永続化対象から除外されるように前記第一のクラスの定義情報を変更し、
前記第二のクラスのオブジェクトの識別属性の値の集合である第二の属性を前記定義情報に追加し、
前記第一の属性に対する前記第二のクラスのオブジェクトの集合の設定要求に応じた処理について、当該集合に含まれるそれぞれの前記第二のクラスのオブジェクトの前記識別属性の値の集合を前記第二の属性に設定するように、前記定義情報を変更し、
前記第一の属性の取得要求に応じた処理について、前記第一の属性に対する変更要求を前記第一の属性及び前記第二の属性に反映させる連動オブジェクトを返却するように、前記定義情報を変更する処理をコンピュータに実行させるプログラム。
(付記8)
前記第一の属性に対する前記第二のクラスのオブジェクトの集合の設定要求に応じた処理について変更する処理は、当該集合と当該集合に含まれるそれぞれの前記第二のクラスのオブジェクトの前記識別属性の値の集合とを、前記連動オブジェクトに参照させ、前記連動オブジェクトを前記第一の属性に設定するように前記定義情報を変更し、
前記連動オブジェクトは、前記第一の属性に対する変更要求に応じ、当該連動オブジェクトが参照する前記第二のクラスのオブジェクトの集合及び前記識別属性の値の集合を変更する付記7記載のプログラム。
(付記9)
前記第一の属性の取得要求に応じた処理について変更する処理は、前記第一の属性に前記連動オブジェクトが設定されている場合は、当該連動オブジェクトを返却し、前記第一の属性に前記連動オブジェクトが設定されていない場合は、前記第二の属性に設定されている前記識別属性の値の集合に対応する前記第二のクラスのオブジェクトの集合を永続化先より取得し、取得された該集合を前記連動オブジェクトに参照させ、該連動オブジェクトを返却するように、前記定義情報を変更する付記8記載のプログラム。
Regarding the above description, the following items are further disclosed.
(Appendix 1)
An exclusion unit that changes the definition information of the first class so that the first attribute that is a set of objects of the second class among the attributes of the first class is excluded from the persistence target;
An adding unit that adds a second attribute that is a set of identification attribute values of the second class of objects to the definition information;
For the processing according to the setting request for the set of objects of the second class for the first attribute, the set of values of the identification attributes of the objects of the second class included in the set is set to the second A first change unit that changes the definition information so as to set the attribute of
For the process according to the acquisition request for the first attribute, the definition information is changed so as to return a linked object that reflects the change request for the first attribute in the first attribute and the second attribute. An information processing apparatus having a second changing unit.
(Appendix 2)
The first changing unit is configured to process the set and the second class of objects included in the set for the processing in response to the setting request for the set of the second class of objects for the first attribute. The set of identification attribute values is referred to by the linked object, and the definition information is changed to set the linked object as the first attribute,
The information processing apparatus according to
(Appendix 3)
When the linked object is set in the first attribute, the second changing unit returns the linked object for the process according to the acquisition request for the first attribute, When the linked object is not set in the attribute, obtain a set of objects of the second class corresponding to the set of identification attribute values set in the second attribute from the persistence destination, The information processing apparatus according to supplementary note 2, wherein the definition information is changed so that the acquired linked object is referred to by the linked object and the linked object is returned.
(Appendix 4)
Among the attributes of the first class, change the definition information of the first class so that the first attribute that is a set of objects of the second class is excluded from the persistence target,
Adding a second attribute that is a set of identification attribute values of the second class of objects to the definition information;
For the processing according to the setting request for the set of objects of the second class for the first attribute, the set of values of the identification attributes of the objects of the second class included in the set is set to the second Change the definition information so that it is set to the attribute of
For the process according to the acquisition request for the first attribute, the definition information is changed so as to return a linked object that reflects the change request for the first attribute in the first attribute and the second attribute. Information processing method in which a computer executes processing to be performed.
(Appendix 5)
The processing for changing the processing in response to the setting request for the set of the second class of objects for the first attribute is the identification attribute of the set and the second class of objects included in the set. The definition information is changed so that the linked object is referred to the set of values, and the linked object is set as the first attribute.
The information processing method according to appendix 4, wherein the linked object changes a set of objects of the second class referenced by the linked object and a set of values of the identification attribute in response to a change request for the first attribute.
(Appendix 6)
In the process of changing the process according to the acquisition request for the first attribute, when the linked object is set in the first attribute, the linked object is returned and the linked to the first attribute. If no object is set, a set of objects of the second class corresponding to a set of values of the identification attribute set in the second attribute is acquired from the persistence destination, and the acquired set The information processing method according to appendix 5, wherein the definition information is changed so that a set is referred to by the linked object and the linked object is returned.
(Appendix 7)
Among the attributes of the first class, change the definition information of the first class so that the first attribute that is a set of objects of the second class is excluded from the persistence target,
Adding a second attribute that is a set of identification attribute values of the second class of objects to the definition information;
For the processing according to the setting request for the set of objects of the second class for the first attribute, the set of values of the identification attributes of the objects of the second class included in the set is set to the second Change the definition information so that it is set to the attribute of
For the process according to the acquisition request for the first attribute, the definition information is changed so as to return a linked object that reflects the change request for the first attribute in the first attribute and the second attribute. A program that causes a computer to execute processing to be performed.
(Appendix 8)
The processing for changing the processing in response to the setting request for the set of the second class of objects for the first attribute is the identification attribute of the set and the second class of objects included in the set. The definition information is changed so that the linked object is referred to the set of values, and the linked object is set as the first attribute.
The program according to appendix 7, wherein the linked object changes a set of objects of the second class and a set of values of the identification attribute referred to by the linked object in response to a change request for the first attribute.
(Appendix 9)
In the process of changing the process according to the acquisition request for the first attribute, when the linked object is set in the first attribute, the linked object is returned and the linked to the first attribute. If no object is set, a set of objects of the second class corresponding to a set of values of the identification attribute set in the second attribute is acquired from the persistence destination, and the acquired set The program according to appendix 8, wherein the definition information is changed so that the linked object is referred to and the linked object is returned.
10 情報処理装置
11 変更対象選択部
12 クラス定義変更部
13 連動コレクションオブジェクト生成部
14 O/Rマッパーアクセス部
15a O/Rマッパー部
15b O/Rマッパー部
16a データストア
16b データストア
21 クラス定義ファイル記憶部
22 オブジェクト配置定義記憶部
100 ドライブ装置
101 記録媒体
102 補助記憶装置
103 メモリ装置
104 CPU
105 インタフェース装置
121 識別属性追加部
122 参照属性除外部
123 参照属性設定メソッド変更部
124 参照属性取得メソッド変更部
B バス
DESCRIPTION OF
105
Claims (5)
前記第二のクラスのオブジェクトの識別属性の値の集合である第二の属性を前記定義情報に追加する追加部と、
前記第一の属性に対する前記第二のクラスのオブジェクトの集合の設定要求に応じた処理について、当該集合に含まれるそれぞれの前記第二のクラスのオブジェクトの前記識別属性の値の集合を前記第二の属性に設定するように、前記定義情報を変更する第一の変更部と、
前記第一の属性の取得要求に応じた処理について、前記第一の属性に対する変更要求を前記第一の属性及び前記第二の属性に反映させる連動オブジェクトを返却するように、前記定義情報を変更する第二の変更部とを有する情報処理装置。 An exclusion unit that changes the definition information of the first class so that the first attribute that is a set of objects of the second class among the attributes of the first class is excluded from the persistence target;
An adding unit that adds a second attribute that is a set of identification attribute values of the second class of objects to the definition information;
For the processing according to the setting request for the set of objects of the second class for the first attribute, the set of values of the identification attributes of the objects of the second class included in the set is set to the second A first change unit that changes the definition information so as to set the attribute of
For the process according to the acquisition request for the first attribute, the definition information is changed so as to return a linked object that reflects the change request for the first attribute in the first attribute and the second attribute. An information processing apparatus having a second changing unit.
前記連動オブジェクトは、前記第一の属性に対する変更要求に応じ、当該連動オブジェクトが参照する前記第二のクラスのオブジェクトの集合及び前記識別属性の値の集合を変更する請求項1記載の情報処理装置。 The first changing unit is configured to process the set and the second class of objects included in the set for the processing in response to the setting request for the set of the second class of objects for the first attribute. The set of identification attribute values is referred to by the linked object, and the definition information is changed to set the linked object as the first attribute,
The information processing apparatus according to claim 1, wherein the linked object changes a set of objects of the second class and a set of values of the identification attribute referred to by the linked object in response to a change request for the first attribute. .
前記第二のクラスのオブジェクトの識別属性の値の集合である第二の属性を前記定義情報に追加し、
前記第一の属性に対する前記第二のクラスのオブジェクトの集合の設定要求に応じた処理について、当該集合に含まれるそれぞれの前記第二のクラスのオブジェクトの前記識別属性の値の集合を前記第二の属性に設定するように、前記定義情報を変更し、
前記第一の属性の取得要求に応じた処理について、前記第一の属性に対する変更要求を前記第一の属性及び前記第二の属性に反映させる連動オブジェクトを返却するように、前記定義情報を変更する処理をコンピュータが実行する情報処理方法。 Among the attributes of the first class, change the definition information of the first class so that the first attribute that is a set of objects of the second class is excluded from the persistence target,
Adding a second attribute that is a set of identification attribute values of the second class of objects to the definition information;
For the processing according to the setting request for the set of objects of the second class for the first attribute, the set of values of the identification attributes of the objects of the second class included in the set is set to the second Change the definition information so that it is set to the attribute of
For the process according to the acquisition request for the first attribute, the definition information is changed so as to return a linked object that reflects the change request for the first attribute in the first attribute and the second attribute. Information processing method in which a computer executes processing to be performed.
前記第二のクラスのオブジェクトの識別属性の値の集合である第二の属性を前記定義情報に追加し、
前記第一の属性に対する前記第二のクラスのオブジェクトの集合の設定要求に応じた処理について、当該集合に含まれるそれぞれの前記第二のクラスのオブジェクトの前記識別属性の値の集合を前記第二の属性に設定するように、前記定義情報を変更し、
前記第一の属性の取得要求に応じた処理について、前記第一の属性に対する変更要求を前記第一の属性及び前記第二の属性に反映させる連動オブジェクトを返却するように、前記定義情報を変更する処理をコンピュータに実行させるプログラム。 Among the attributes of the first class, change the definition information of the first class so that the first attribute that is a set of objects of the second class is excluded from the persistence target,
Adding a second attribute that is a set of identification attribute values of the second class of objects to the definition information;
For the processing according to the setting request for the set of objects of the second class for the first attribute, the set of values of the identification attributes of the objects of the second class included in the set is set to the second Change the definition information so that it is set to the attribute of
For the process according to the acquisition request for the first attribute, the definition information is changed so as to return a linked object that reflects the change request for the first attribute in the first attribute and the second attribute. A program that causes a computer to execute processing to be performed.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2011174319A JP5673431B2 (en) | 2011-08-09 | 2011-08-09 | Information processing apparatus, information processing method, and program |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2011174319A JP5673431B2 (en) | 2011-08-09 | 2011-08-09 | Information processing apparatus, information processing method, and program |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2013037585A JP2013037585A (en) | 2013-02-21 |
JP5673431B2 true JP5673431B2 (en) | 2015-02-18 |
Family
ID=47887138
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2011174319A Expired - Fee Related JP5673431B2 (en) | 2011-08-09 | 2011-08-09 | Information processing apparatus, information processing method, and program |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP5673431B2 (en) |
Family Cites Families (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPS62209615A (en) * | 1986-02-26 | 1987-09-14 | Fujitsu Ltd | Data base processing system |
JPH04139546A (en) * | 1990-10-01 | 1992-05-13 | Matsushita Electric Ind Co Ltd | Relational data base device |
US7437371B2 (en) * | 2004-02-10 | 2008-10-14 | Microsoft Corporation | Systems and methods for the implementation of unordered and ordered collections in a data store |
KR101030368B1 (en) * | 2004-04-30 | 2011-04-20 | 마이크로소프트 코포레이션 | Systems and methods for the implementation of unordered and ordered collections in a data store |
-
2011
- 2011-08-09 JP JP2011174319A patent/JP5673431B2/en not_active Expired - Fee Related
Also Published As
Publication number | Publication date |
---|---|
JP2013037585A (en) | 2013-02-21 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
EP2784665B1 (en) | Program and version control method | |
TWI479341B (en) | High throughput, reliable replication of transformed data in information systems | |
US7457817B2 (en) | Versioning in an integration platform | |
US9830341B2 (en) | Resource name generation and derivation utilizing attribute space monikers and their associated context | |
US7043481B2 (en) | System, method and software for creating, maintaining, navigating or manipulating complex data objects and their data relationships | |
US9229982B2 (en) | Processing queries using oriented query paths | |
WO2020028527A1 (en) | Open-source software vulnerability analysis | |
US7467163B1 (en) | System and method to manipulate large objects on enterprise server data management system | |
US10803061B2 (en) | Software vulnerability graph database | |
US20060235899A1 (en) | Method of migrating legacy database systems | |
US11397575B2 (en) | Microservices graph generation | |
KR101137070B1 (en) | Priority binding | |
CN101027639A (en) | System and method for extraction and creation of application meta-information within a software application repository | |
US10649744B1 (en) | Systems and methods for handling renaming of programming constructs in programming environments | |
US20080201290A1 (en) | Computer-implemented methods, systems, and computer program products for enhanced batch mode processing of a relational database | |
CN112860312A (en) | Method and device for detecting item dependency relationship change | |
JP4432087B2 (en) | Database update management system, program and method | |
CN113515303B (en) | Project transformation method, device and equipment | |
Ba et al. | Uncertain version control in open collaborative editing of tree-structured documents | |
JP5673431B2 (en) | Information processing apparatus, information processing method, and program | |
CN117193802A (en) | Merge space providing access to multiple instances of application content | |
US9946778B2 (en) | System and method for copying data | |
Asma et al. | NPCS: Native Provenance Computation for SPARQL | |
JPWO2011099082A1 (en) | Database management system | |
JP2017016208A (en) | Virtual database system management apparatus, management method, and management program |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20140404 |
|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20141106 |
|
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: 20141202 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20141215 |
|
R150 | Certificate of patent or registration of utility model |
Ref document number: 5673431 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R150 |
|
LAPS | Cancellation because of no payment of annual fees |