[ 
https://issues.apache.org/jira/browse/GEODE-8626?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17227757#comment-17227757
 ] 

ASF GitHub Bot commented on GEODE-8626:
---------------------------------------

masaki-yamakawa commented on a change in pull request #5637:
URL: https://github.com/apache/geode/pull/5637#discussion_r519153180



##########
File path: 
geode-connectors/src/distributedTest/java/org/apache/geode/connectors/jdbc/internal/cli/CreateMappingCommandDUnitTest.java
##########
@@ -1142,7 +1142,7 @@ public void createMappingWithExistingQueueFails() {
             + " must not already exist.");
   }
 
-  private static class Employee implements PdxSerializable {
+  public static class Employee implements PdxSerializable {

Review comment:
       In the test, `CreatemappingPreconditionCheckFunction` is called and 
executed on several JVMs(Distributed members).
   In this Function, PDX class such as Employee is instantiated, so I need to 
be able to access this class even if it runs on another JVM.
   If it is in private scope, the following exceptions will be thrown
   
   ```
   [error 2020/11/07 12:08:19.411 JST <Function Execution Processor2> tid=69] 
Could not generate a PdxType for the class 
org.apache.geode.connectors.jdbc.internal.cli.CreateMappingCommandDUnitTest$IdAndName
 because it did not have a public zero arg constructor. Details: 
java.lang.IllegalAccessException: Class 
org.apache.geode.connectors.jdbc.internal.JdbcConnectorServiceImpl can not 
access a member of class 
org.apache.geode.connectors.jdbc.internal.cli.CreateMappingCommandDUnitTest$IdAndName
 with modifiers "public"
   org.apache.geode.connectors.jdbc.JdbcConnectorException: Could not generate 
a PdxType for the class 
org.apache.geode.connectors.jdbc.internal.cli.CreateMappingCommandDUnitTest$IdAndName
 because it did not have a public zero arg constructor. Details: 
java.lang.IllegalAccessException: Class 
org.apache.geode.connectors.jdbc.internal.JdbcConnectorServiceImpl can not 
access a member of class 
org.apache.geode.connectors.jdbc.internal.cli.CreateMappingCommandDUnitTest$IdAndName
 with modifiers "public"
       at 
org.apache.geode.connectors.jdbc.internal.JdbcConnectorServiceImpl.createInstance(JdbcConnectorServiceImpl.java:361)
       at 
org.apache.geode.connectors.jdbc.internal.JdbcConnectorServiceImpl.generatePdxTypeForClass(JdbcConnectorServiceImpl.java:334)
       at 
org.apache.geode.connectors.jdbc.internal.JdbcConnectorServiceImpl.getPdxTypeForClass(JdbcConnectorServiceImpl.java:320)
       at 
org.apache.geode.connectors.jdbc.internal.cli.CreateMappingPreconditionCheckFunction.executeFunction(CreateMappingPreconditionCheckFunction.java:74)
       at 
org.apache.geode.management.cli.CliFunction.execute(CliFunction.java:37)
       ...
   ```
   
   Other similar tests like CreateMapingCommandForProxyRegionDUnitTest are also 
public scope.




----------------------------------------------------------------
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.

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


> Omitting field-mapping tag of cache.xml when using Simple JDBC Connector
> ------------------------------------------------------------------------
>
>                 Key: GEODE-8626
>                 URL: https://issues.apache.org/jira/browse/GEODE-8626
>             Project: Geode
>          Issue Type: Improvement
>          Components: jdbc
>            Reporter: Masaki Yamakawa
>            Priority: Minor
>              Labels: pull-request-available
>
> When configuring Simple JDBC Connector with gfsh, I don't need to create 
> field-mapping, the default field-mapping will be created from pdx and table 
> meta data.
> On the other hand, when using cache.xml(cluster.xml), pdx and table meta data 
> cannot be used, and field-mapping must be described in cache.xml.
> I would like to create field-mapping defaults based on pdx and table meta 
> data when using cache.xml.
> If field-mapping is specified in cache.xml, the xml setting has priority, and 
> only if there are no field-mapping tags.
> cache.xml will be as follows:
> {code:java}
> <region name="Region1" refid="REPLICATE">
>     <jdbc:mapping
>             data-source="TestDataSource"
>             table="employees"
>             pdx-name="org.apache.geode.connectors.jdbc.Employee"
>             ids="id">
> <!-- no need to jdbc:field-mapping tag
>         <jdbc:field-mapping pdx-name="id" pdx-type="STRING" jdbc-name="id" 
> jdbc-type="VARCHAR" jdbc-nullable="false"/>
>         <jdbc:field-mapping pdx-name="name" pdx-type="STRING" 
> jdbc-name="name" jdbc-type="VARCHAR" jdbc-nullable="true"/>
>         <jdbc:field-mapping pdx-name="age" pdx-type="INT" jdbc-name="age" 
> jdbc-type="INTEGER" jdbc-nullable="true"/>
> -->
>     </jdbc:mapping>
> </region>
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to