javaintersystems-cacheintersystemsintersystems-ensemble

Set a datatype java.util.Date property of proxy Java Object in Cache by Gateway Java


I'm implementing a solution that integrates a Caché application with a Java application by a Java Gateway. In the Java application I have a object what have a property of datatype "java.util.Date" and I have to set this in the Caché application. What datatype Caché I can using for this and how set this variable in Caché?

Code:

S data = ???
S obj = ##class(my.objectClass).%New(gateway) 
D obj.setDh(data)

The class my.objectClass is a proxy class and data type of parameter in setDh() is java.sql.Date.

When I can set the data variable?

Regards,

Lucas Boeing Scarduelli.


Solution

  • I resolved my problem with the following solution.

    In Java application, on class my.objectClass I assign propert as java.sql.Timestamp, consequently the setDh() with same data type parameter.

    In Caché application, when I have to assign value of this proxy class I do so:

    S data = $ZDT($H,3)
    S obj = ##class(my.objectClass).%New(gateway) 
    D obj.setDh(data)
    

    Why use java.sql.Timestamp rather then java.sql.Date?

    Basically because in my case I need of date and time information, and the native parser of java.sql.Date only consider the date information. Already the java.sql.Timestamp native parser consider date and time information.