1

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.

2 Answers2

1

As Java Proxy Class Mapping points out, there's a mapping for java.sql.Date to Caché type DATE, you might be good adviced to use that. As java.sql.Date is a subclass of java.util.Date and java.sql.Date has a constructor taking a java.util.Date conversion on Java side should be quite simple.

Jan
  • 13,738
  • 3
  • 30
  • 55
0

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.