okumin commented on code in PR #5804:
URL: https://github.com/apache/hive/pull/5804#discussion_r2084485270


##########
standalone-metastore/metastore-server/src/main/resources/package.jdo:
##########
@@ -364,32 +380,13 @@
       </field>
     </class>
 
-    <class name="MColumnDescriptor" identity-type="datastore" table="CDS" 
detachable="true">
-      <datastore-identity>
-        <column name="CD_ID"/>
-      </datastore-identity>
-      <field name="cols" persistence-modifier="persistent" table="COLUMNS_V2">
-        <collection element-type="MFieldSchema" dependent-element="true" />
-        <join>
-          <primary-key name="SQL110922153006740">
-            <column name="CD_ID"/>
-            <column name="COLUMN_NAME"/>
-          </primary-key>
-          <column name="CD_ID"/>
-        </join>
-        <element>
-          <embedded>
-            <field name="name">
-              <column name="COLUMN_NAME" length="767" jdbc-type="VARCHAR" 
allows-null="false"/>
-            </field>
-            <field name="type">
-              <column name="TYPE_NAME" length="32672" jdbc-type="VARCHAR" 
allows-null="false"/>
-            </field>
-            <field name="comment">
-              <column name="COMMENT" length="256" jdbc-type="VARCHAR" 
allows-null="true"/>
-            </field>
-          </embedded>
-        </element>
+    <class name="MColumnDescriptor" identity-type="application" table="CDS" 
detachable="true">
+      <field name="id" primary-key="true" value-strategy="native">
+        <column name="CD_ID" jdbc-type="BIGINT" />
+      </field>
+      <field name="columns" mapped-by="cd">
+        <order column="INTEGER_IDX"/>
+        <collection element-type="MColumn" dependent-element="true" />

Review Comment:
   I referred to this document to know how JDO with collections works.
   
https://www.datanucleus.org/products/accessplatform_4_1/jdo/orm/one_to_many_collection.html



##########
standalone-metastore/metastore-server/src/main/resources/package.jdo:
##########
@@ -115,6 +115,22 @@
       </field>
     </class>
 
+    <class name="MColumn" identity-type="application" table="COLUMNS_V2" 
detachable="true" objectid-class="MColumn$PK">

Review Comment:
   I understand we need `objectid-class` because the PK is composed of two 
columns.
   
https://www.datanucleus.org/products/accessplatform_4_2/jdo/application_identity.html#primarykey



##########
standalone-metastore/metastore-server/src/main/resources/package.jdo:
##########
@@ -364,32 +380,13 @@
       </field>
     </class>
 
-    <class name="MColumnDescriptor" identity-type="datastore" table="CDS" 
detachable="true">
-      <datastore-identity>
-        <column name="CD_ID"/>
-      </datastore-identity>
-      <field name="cols" persistence-modifier="persistent" table="COLUMNS_V2">
-        <collection element-type="MFieldSchema" dependent-element="true" />
-        <join>
-          <primary-key name="SQL110922153006740">
-            <column name="CD_ID"/>
-            <column name="COLUMN_NAME"/>
-          </primary-key>
-          <column name="CD_ID"/>
-        </join>
-        <element>
-          <embedded>
-            <field name="name">
-              <column name="COLUMN_NAME" length="767" jdbc-type="VARCHAR" 
allows-null="false"/>
-            </field>
-            <field name="type">
-              <column name="TYPE_NAME" length="32672" jdbc-type="VARCHAR" 
allows-null="false"/>
-            </field>
-            <field name="comment">
-              <column name="COMMENT" length="256" jdbc-type="VARCHAR" 
allows-null="true"/>
-            </field>
-          </embedded>
-        </element>
+    <class name="MColumnDescriptor" identity-type="application" table="CDS" 
detachable="true">
+      <field name="id" primary-key="true" value-strategy="native">

Review Comment:
   The native strategy sounds good, though I'm not a specialist of JDO.
   
https://www.datanucleus.org/products/accessplatform_4_2/jdo/value_generation.html



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org
For additional commands, e-mail: gitbox-h...@hive.apache.org

Reply via email to