Use java.util.Date in the JMX query
Hello All
Anybody know How to write JMX query for finding InstanceObject by attribute that has java.lang.Date type
Best regards
Just refer to each class explicitly, through a fully qualified class name as:
java.util.Date myDate = new java.util.Date();
Similar Messages
-
How can I use java.util.Date and change display format.
Hello All,
I want to use java.util.Date in View Context and in Custom Control Context of Web dynpro java. When i mapped of a Input Field to the java.util.Date then message shows that its not supported. Plz suggest me how to handle Date with different formats ??If you always want the user to enter the date in dd/MM/yyyy, you can do the following.
Goto Local Dictonary -> Simple types in your project and create a type known as "InputDate" (or whatever you feel) of built-in type 'Date'.
Now specifiy its format in the 'Representation' tab as "dd/MM/yyyy" (case-senstive).
Now declare a value attribute say "inputdate" in your context with this type and bind the inputfield to this context value attribute.
This will solve your problem.
But if you want the user to input date depending on the region he belongs, change the default locale date in Control Panel->Regional and Language Options->Change to English(UK) -> Customize -> Date Tab -> Sort Date Format to dd/MM/yyyy.
Now clear the cache, delete temporary files and restart the machine. This should solve the problem. -
Error while deploying a web service whose return type is java.util.Date
Hi
I have written a simple web service which takes in a date input (java.util.Date) and returns the same date back to the client.
public interface Ping extends Remote
* A simple method that pings the server to test the webservice.
* It sends a datetime to the server which returns the datetime.
* @param pingDateRequest A datetime sent to the server
* @returns The original datetime
public Date ping(Date pingDateRequest) throws RemoteException;
The generation of the Web service related files goes smoothly in JDeveloper 10g. The problem arises when I try to deploy this web service on the Oracle 10g (10.0.3) OC4J standalone. it gives me the following error on the OC4J console :
E:\Oracle\oc4j1003\j2ee\home\application-deployments\Sachin-TradingEngineWS-WS\
WebServices\com\sachin\tradeengine\ws\Ping_Tie.java:57: ping(java.util.Date) in com.sachin.tradeengine.ws.Ping cannot be applied to (java.util.Calendar) _result = ((com.sachin.tradeengine.ws.Ping) getTarget()).ping
(myPing_Type.getDate_1());
^
1 error
04/03/23 17:17:35 Notification ==> Application Deployer for Sachin-TradingEngineWS-WS FAILED: java.lang.InstantiationException: Error compiling :E:\Oracle\oc4j1003\j2ee\home\applications\Sachin-TradingEngineWS-WS\WebServices: Syntax error in source [ 2004-03-23T17:17:35.937GMT+05:30 ]
I read somewhere that the conversion between java to xml datatype and vice versa fails for java.util.Date, so it is better to use java.util.Calendar. When I change the code to return a java.util.Calendar then the JDeveloper prompts me the following failure:
Method Ping: the following parameter types do not have an XML Schema mapping and/or serializer specified : java.util.Calendar.
This forces me to return a String data.
I would appreciate if someone can help me out.
Thanks
Sachin Mathias
Datamatics Ltd.Hi
I got the web service working with some work around. But I am not sure it this approach would be right and good.
I started altogether afresh. I did the following step :
1. Created an Interface (Ping.java) for use in web Service as follows :
public interface Ping extends Remote{
public java.util.Date ping(java.util.Date pingDateRequest)
throws RemoteException;
2. Implemented the above interface in PingImpl.java as follows :
public class PingImpl implements Ping
public java.util.Date ping(java.util.Date pingDateRequest) throws RemoteException {
System.out.println("PingImpl: ping() return datetime = " + pingDateRequest.toString());
return pingDateRequest;
3. Compiled the above 2 java files.
4. Generated a Stateless Java Web Service with the help of JDeveloper. This time the generation was sucessful.(If I had "java.util.Calendar" in place of "java.util.Date" in the java code of the above mentioned files the web service generation would prompt me for error)
5. After the generation of Web Service, I made modification to the Ping interface and its implementing class. In both the files I replaced "java.util.Date" with "java.util.Calendar". The modified java will look as follows :
Ping.Java
=========
public interface Ping extends Remote{
public java.util.Calendar ping(java.util.Calendar pingDateRequest)
throws RemoteException;
PingImpl.Java
================
public class PingImpl implements Ping
public java.util.Calendar ping(java.util.Calendar pingDateRequest) throws RemoteException {
System.out.println("PingImpl: ping() return datetime = " + pingDateRequest.toString());
return pingDateRequest;
6. Now I recompile both the java files.
7. Withour regenerating the Web Service I deploy the Web Service on OC4j 10.0.3 from JDeveloper. This time the deployment was sucessful.(The Deployment fails if I don't follow the step 5.)
8. Now I generated a Stub from JDeveloper and accessed the stub from a client. It works fine. Here if you see the Stub code it takes java.util.Date as a parameter and returns a java.util.Date. (Mind you I am accepting a java.util.Calendar and returning the same in my Web Service interface. Step 5)
The confusing thing is the Serialization and Deserialization of Data from Client java data to Soap message and Soap message to Server java data.
From Client to SOAP :
java.util.Date to datetime
From SOAP to Server :
datetime to java.util.Calendar
From Server to SOAP :
java.util.Calendar to datetime
From SOAP to Client :
datetime to java.util.Date (I am not able to understand this part of the conversion)
Any help or inputs would be appreciated.
Thanks
Sachin Mathias -
What's wrong with java.util.Date??
Hi all,
I was just practicing a bit of java.util ,when i was compiling my code-
import java.util.Date;
import java.text.SimpleDateFormat;
class DateStamp{
public static void Main(String args[]){
doDate1;
String D;
int D1,D2,D3;
Date dt=new Date();
SimpleDateFormat sdf=new SimpleDateFormat("dd-mm-yyyy");
/*When using method .setDate(x) ,is x an integer or String?can x=2/5/2002 or 2-5-2002?*/
public void doDate1{
dt.setDay(12);
dt.setMonth(12);
dt.setYear(102);
D=dt.getTime();
D.parseInt(D1);D=""
D=sdf.getTime();
D.parseInt(D2);
int D3=D2-D1;
int D3=D3/86400000;/*How do you convert milisec-to-days?*/
D=D3.toString().
System.out.println(D+"days have elapsed since then");
the compiler said this-
File Compiled...
--------------------------- Javac Output ---------------------------
DateStamp.java:7: Invalid expression statement.doDate1;^DateStamp.java:14: Instance variables can't be void: doDate1public void doDate1; ^2 errors
this problem is persistant, and i'm a java newbie ,Does anyone know what's wrong here?
Thanks!
Regards,
aesh83How do you get System date onto a Date variable?Calendar.getInstance().getTime() returns a java.util.Date for the current time. You can also use System.currentTimeMillis() and turn it into a Date.
Will date.after(Date when) method work when Date
variables are in milisecs?Date.after(Date when) compares two date objects. As the JavaDoc says "Returns:
true if and only if the instant represented by this Date object is strictly later than the instant represented by when" To me that says that milliseconds are taken into account, I.E. comparing dates actually compares the date plus the time portion.
>
What methods-
*Convert a date(dd/mm/yy) to milisec?If you look in the javaDoc you'll see "long getTime() Returns the number of milliseconds since January 1, 1970, 00:00:00 GMT represented by this Date object." Calendar also has the getTimeInMillis() method.
*Convert a milisec value to a date(dd/mm/yy)?Calendar.setTimeInMillis(long);
I'm have this little problem.
When using GregorianCalander-
*need to initialize?
*need set today's date?Calendar.getInstance() will return an appropriate Calendar object for the current locale initialized to the current date/time.
*how do you check if a date exceeds 3 weeks?I'm not sure what you mean. There are a couple of roll(...) methods that will allow you to add a unit of time to a date. I.E. you could add three weeks to a date.
To ignore the time portion of a date just set the time to "00:00"
Col -
(Again) java.util.Date vs java.sql.Date
Hi there,
(Again) Im trying to understand the EXACT difference between
java.util.Date vs java.sql.Date.
Googling, I can see that this is a very "popular" subject, but I still
cannot figure out it exactly.
Many writers claim that java.sql.Date only stores the DATE part (yyyy-
mm-dd) but not the TIME part (hh:MM:ss) of a Date/Time value, but that
I can easily disprove:
java.util.Date ud = new java.util.Date(); java.sql.Date sd = new java.sql.Date(ud.getTime()); System.out.println(DateFormatUtils. format(ud, "yyyy-MM-dd HH:mm:ss.SSS")); System.out.println(DateFormatUtils. format(sd, "yyyy-MM-dd HH:mm:ss.SSS"));
Output:
2009-09-18 15:17:36.635 2009-09-18 15:17:36.635
So, apparently, java.sql.Date and java.util.Date have THE SAME
precision (at least down to the millisecs...).
And the official API documentation, really looks more confusing than
helpful to me::
*"java.sql.Date:*
*A thin wrapper around a millisecond value that allows JDBC to identify*
*this as an SQL DATE value. A milliseconds value represents the*
*number of milliseconds that have passed since January 1, 1970*
*00:00:00.000 GMT.*
*To conform with the definition of SQL DATE, the millisecond values*
*wrapped by a java.sql.Date instance must be 'normalized' by setting*
*the hours, minutes, seconds, and milliseconds to zero in the*
*particular time zone with which the instance is associated. "*
Exactly what means "an SQL DATE value" ? How EXACTLY does it differ
from a java.util.Date value?
Most importantly: WHY does JDBC need to distinguish between them?
And, here again: *"a java.sql.Date instance must be 'normalized' by*
*setting the hours, minutes, seconds, and milliseconds to zero in the*
*particular time zone..."*
What does that mean exactly? Apparently, the constructor doesnt
enforce this restriction, per the example above. So what's the REAL
point with this type, java.sql.Date?
Very greatful, if you can help me clarify this, once and for all.
TIA,And the official API documentation, really looks more confusing than helpful to me:The problem is that you need to understand SQL as well as Java for this to make sense. It's not the Java API's job to tell you how your SQL database works - there's a myriad of subtle differences even when the DB is compliant with the SQL spec.
Most compliant databases support DATE, TIME, and TIMESTAMP values. DATE represents only a date. TIME represents only a time. TIMESTAMP represents both. There are further complicating factors, but that's roughly how it stands.
In Java the normal type for representing time is (or was when the API was created) the java.util.Date but this is a close approximation only to the TIMESTAMP value. In order to bring the two together the java.sql.Date, java.sql.Time and java.sql.Timestamp classes were created. Making them derive from java.util.Date was probably not a good idea.
java.util.Date suffers from a number of deficiencies. java.util.Calendar was supposed to address them but didn't really succeed. The JodaTime library is rather better, but it's all a lot more complicated than you might expect - partly because time management really is a much harder problem than it appears at first glance - there are timezones, leap years, leap seconds, the difference between astronomical and atomic time, and so on and so forth. -
Java.sql.Date and java.util.Date - class loaded first in the classpath
I had two jar files which has java.util.Date and java.sql.Date class file. i want to know whether which class is loaded first in the classpath...
I like to change the order of loading the class at runtime...
Is there is any way to change the order of loading of class...
I may have different version of jar files for example xerces,xercesImpl. some of the code uses xerces ,some of the code uses xercesImpl..i had common classes.
I like to load the class with the same name according to the order i need..
Can we do all these in Run time ?????I had two jar files which has java.util.Date and
java.sql.Date class file. i want to know whether
which class is loaded first in the classpath...
I like to change the order of loading the class at
runtime...
Is there is any way to change the order of loading of
class...
I may have different version of jar files for example
xerces,xercesImpl. some of the code uses xerces ,some
of the code uses xercesImpl..i had common classes.
I like to load the class with the same name according
to the order i need..
Can we do all these in Run time ?????That is meaningless.
The classes you are referring to are part of the Java API. Third party jars have no impact on that. And you can't change to the order because java.sql.Data is derived from java.util.Date. So the second must load before the first.
And if you have two jar files with those classes in them (and not classes that use them) then you either should already know how to use them or you should stop trying to do whatever you are doing because it isn't going to work. -
Get days from the java.util.date class
Does anyone know how to get the days from the java.util.date
class. I'm trying to subtract two dates to get the total days between
the two dates. Any help would be appriciated
RobIf you use the getTime() method, you get the date as a number of milliseconds since a predefined time. You can do arithmetic on that number, such as subtracting two of them to get the number of milliseconds between two Dates, and so on.
-
Hi, I have a hard disk failure so to recover my data I am using disk utility to restore the data on an external drive while booting from a second external hard drive. When I perform the operation and after having selected both my destination and source drives, the operation begins but soon fails due to input/output error. If I try to create an image of the drive it gives me the same error message. Any help would be much appreciated.
Disk Utility only creates a image of the drive, so it's no help getting exactly what you want, which is your files. If the file structure is messed up or the drive is failing then it's no help.
If you have a external boot drive and you can't access the internal non-booting drive though the typical Finder and windows to transfer your files via drag and drop methods, then you need to install Data Rescue on the external boot drive and it will do as best as it can to recover your files. (works on non-encrypted/non-Filevaulted drives only)
.Create a data recovery/undelete external boot drive
Are you sure you have hard drive failure, or that OS X isn't merely not booting?
Because if the drive is working physically, then there is a host of fixes
..Step by Step to fix your Mac
https://discussions.apple.com/community/notebooks/macbook_pro?view=documents#/ -
Modifying JAR file using java.util.jar package over the network
Hello,
I am modifying a JAR file programmatically using java.util.jar package. The time taken to save the contents to a local disk is very less (around 1 sec) . When I tried modifying the JAR from a remote machine over the network (from mapped drive or shared folder of WIN NT), the time taken to save is 15-20 times more.
I am recreating the whole JAR while modifying. Is there any way to improve the performance. Or is it possible to write only the changed files?
Thanks,
Prasad Y S.When you "update" a jar file, you must always recreate it from scratch.
-
CreateQuery and java.util.Date
I have a database fiedl that has a Date type, so after creating my named query, I am setting the currenty date to the field using
query.setParameter("createDate", new java.util.Date());
I get a failure after doing this because TopLink gets an unexpectedToken EJBQLException in trying to parse "Fri" in the resulting query like this
p.createDate = Fri Dec 21 00:00:00 PST 2007
what should I do to get this query to run. I hope I am clear.
MichaelFor java.sql.Date the spec. defines the following setParameter method (3.6.1 Query Interface):
* Bind an instance of java.util.Date to a named parameter.
* @param name
* @param value
* @param temporalType
* @return the same query instance
* @throws IllegalArgumentException if parameter name does not
* correspond to parameter in query string
public Query setParameter(String name, Date value, TemporalType
temporalType); -
Why not Deprecate java.util.Date and java.util.Calendar
With the introduction of java.time, why did you not flag java.util.Date and java.util.Calendar. These classes have been a bane to every Java developer and should never be used again with the introduction of Java 1.8.
Adding the @Deprecated annotation would only just provide a warning about an old API and recommendation to the developer(s) to no longer use it. Doing so would not break any existing library out there; in fact quite a number of constructors and methods on the Date class have already been flagged deprecated.
The new java.time package is far superior to Date/Calendar. -
All I want to do is create a java.sql.Date subclass which has the Date(String) constructor, some checks for values and a few other additional methods and that avoids deprecation warnings/errors.
I am trying to write a wrapper for the java.sql.Date class that would allow a user to create a Date object using the methods:
Date date1 = new Date(2003, 10, 7);ORDate date2 = new Date("2003-10-07");I am creating classes that mimic MySQL (and eventually other databases) column types in order to allow for data checking since MySQL does not force checks or throw errors as, say, Oracle can be set up to do. All the types EXCEPT the Date, Datetime, Timestamp and Time types for MySQL map nicely to and from java.sql.* objects through wrappers of one sort or another.
Unfortunately, java.sql.Date, java.sql.Timestamp, java.sql.Time are not so friendly and very confusing.
One of my problems is that new java.sql.Date(int,int,int); and new java.util.Date(int,int,int); are both deprecated, so if I use them, I get deprecation warnings (errors) on compile.
Example:
public class Date extends java.sql.Date implements RangedColumn {
public static final String RANGE = "FROM '1000-01-01' to '8099-12-31'";
public static final String TYPE = "DATE";
* Minimum date allowed by <strong>MySQL</strong>. NOTE: This is a MySQL
* limitation. Java allows dates from '0000-01-01' while MySQL only supports
* dates from '1000-01-01'.
public static final Date MIN_DATE = new Date(1000 + 1900,1,1);
* Maximum date allowed by <strong>Java</strong>. NOTE: This is a Java limitation, not a MySQL
* limitation. MySQL allows dates up to '9999-12-31' while Java only supports
* dates to '8099-12-31'.
public static final Date MAX_DATE = new Date(8099 + 1900,12,31);
protected int _precision = 0;
private java.sql.Date _date = null;
public Date(int year, int month, int date) {
// Deprecated, so I get deprecation warnings from the next line:
super(year,month,date);
if(! isWithinRange(this))
throw new ValueOutOfRangeException((RangedColumn)this, "" + this);
public Date(String s) {
super(0l);
// Start Cut-and-paste from java.sql.Date.valueOf(String s)
int year;
int month;
int day;
int firstDash;
int secondDash;
if (s == null) throw new java.lang.IllegalArgumentException();
firstDash = s.indexOf('-');
secondDash = s.indexOf('-', firstDash+1);
if ((firstDash > 0) & (secondDash > 0) & (secondDash < s.length()-1)) {
year = Integer.parseInt(s.substring(0, firstDash)) - 1900;
month = Integer.parseInt(s.substring(firstDash+1, secondDash)) - 1;
day = Integer.parseInt(s.substring(secondDash+1));
} else {
throw new java.lang.IllegalArgumentException();
// End Cut-and-paste from java.sql.Date.valueOf(String s)
// Next three lines are deprecated, causing warnings.
this.setYear(year);
this.setMonth(month);
this.setDate(day);
if(! isWithinRange(this))
throw new ValueOutOfRangeException((RangedColumn)this, "" + this);
public static boolean isWithinRange(Date date) {
if(date.before(MIN_DATE))
return false;
if(date.after(MAX_DATE))
return false;
return true;
public String getRange() { return RANGE; }
public int getPrecision() { return _precision; }
public String getType() { return TYPE; }
}This works well, but it's deprecated. I don't see how I can use a java.util.Calendar object in stead without either essentially re-writing java.sql.Date almost entirely or losing the ability to be able to use java.sql.PreparedStatement.get[set]Date(int pos, java.sql.Date date);
So at this point, I am at a loss.
The deprecation documentation for constructor new Date(int,int,int)says "instead use the constructor Date(long date)", which I can't do unless I do a bunch of expensive String -> [Calendar/Date] -> Milliseconds conversions, and then I can't use "super()", so I'm back to re-writing the class again.
I can't use setters like java.sql.Date.setYear(int) or java.util.setMonth(int) because they are deprecated too: "replaced by Calendar.set(Calendar.DAY_OF_MONTH, int date)". Well GREAT, I can't go from a Date object to a Calendar object, so how am I supposed to use the "Calendar.set(...)" method!?!? From where I'm sitting, this whole Date deprecation thing seems like a step backward not forward, especially in the java.sql.* realm.
To prove my point, the non-deprecated method java.sql.Date.valueOf(String) USES the DEPRECATED constructor java.util.Date(int,int,int).
So, how do I create a java.sql.Date subclass which has the Date(String) constructor that avoids deprecation warnings/errors?
That's all I really want.
HELP!I appreciate your help, but what I was hoping to accomplish was to have two constructors for my java.sql.Date subclass, one that took (int,int,int) and one that took ("yyyy-MM-dd"). From what I gather from your answers, you don't think it's possible. I would have to have a static instantiator method like:public static java.sql.Date createDate (int year, int month, int date) { ... } OR public static java.sql.Date createDate (String dateString) { ... }Is that correct?
If it is, I have to go back to the drawing board since it breaks my constructor paradigm for all of my 20 or so other MySQL column objects and, well, that's not acceptable, so I might just keep my deprecations for now.
-G -
I have a session bean which is published as a web service. The methods in this bean have a return type of java.util.Date.
I am unable to invoke any of these web services method in Studio creator. These work fine with a .NET client. The exception is as follows:
InvocationTargetException com.sun.rave.websvc.ui.ReflectionHelper.callMethodWithParams(ReflectionHelper.java:451) com.sun.rave.websvc.ui.TestWebServiceMethodDlg.invokeMethod(TestWebServiceMethodDlg.java:361) com.sun.rave.websvc.ui.TestWebServiceMethodDlg.access$500(TestWebServiceMethodDlg.java:55) com.sun.rave.websvc.ui.TestWebServiceMethodDlg$4.run(TestWebServiceMethodDlg.java:301) java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178) java.awt.EventQueue.dispatchEvent(EventQueue.java:454) java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201) java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151) java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145) java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137) java.awt.EventDispatchThread.run(EventDispatchThread.java:100) null sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) java.lang.reflect.Method.invoke(Method.java:324) com.sun.rave.websvc.ui.ReflectionHelper.callMethodWithParams(ReflectionHelper.java:445) com.sun.rave.websvc.ui.TestWebServiceMethodDlg.invokeMethod(TestWebServiceMethodDlg.java:361) com.sun.rave.websvc.ui.TestWebServiceMethodDlg.access$500(TestWebServiceMethodDlg.java:55) com.sun.rave.websvc.ui.TestWebServiceMethodDlg$4.run(TestWebServiceMethodDlg.java:301) java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178) java.awt.EventQueue.dispatchEvent(EventQueue.java:454) java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201) java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151) java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145) java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137) java.awt.EventDispatchThread.run(EventDispatchThread.java:100) Runtime exception; nested exception is: deserialization error: java.lang.NumberFormatException: For input string: "" com.sun.xml.rpc.client.StreamingSender._handleRuntimeExceptionInSend(StreamingSender.java:248) com.sun.xml.rpc.client.StreamingSender._send(StreamingSender.java:230) webservice.AddDates_Stub.addToDay(AddDates_Stub.java:68) webservice.AddDatesServiceClient.adddatesserviceAddToDay(AddDatesServiceClient.java:19) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) java.lang.reflect.Method.invoke(Method.java:324) com.sun.rave.websvc.ui.ReflectionHelper.callMethodWithParams(ReflectionHelper.java:445) com.sun.rave.websvc.ui.TestWebServiceMethodDlg.invokeMethod(TestWebServiceMethodDlg.java:361) com.sun.rave.websvc.ui.TestWebServiceMethodDlg.access$500(TestWebServiceMethodDlg.java:55) com.sun.rave.websvc.ui.TestWebServiceMethodDlg$4.run(TestWebServiceMethodDlg.java:301) java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178) java.awt.EventQueue.dispatchEvent(EventQueue.java:454) java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201) java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151) java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145) java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137) java.awt.EventDispatchThread.run(EventDispatchThread.java:100) deserialization error: java.lang.NumberFormatException: For input string: "" com.sun.xml.rpc.encoding.SimpleTypeSerializer.deserialize(SimpleTypeSerializer.java:142) webservice.Date_SOAPSerializer.doDeserialize(Date_SOAPSerializer.java:60) com.sun.xml.rpc.encoding.ObjectSerializerBase.deserialize(ObjectSerializerBase.java:167) com.sun.xml.rpc.encoding.ReferenceableSerializerImpl.deserialize(ReferenceableSerializerImpl.java:134) webservice.AddDates_AddToDay_ResponseStruct2_SOAPSerializer.doDeserialize(AddDates_AddToDay_ResponseStruct2_SOAPSerializer.java:40) com.sun.xml.rpc.encoding.ObjectSerializerBase.deserialize(ObjectSerializerBase.java:167) com.sun.xml.rpc.encoding.ReferenceableSerializerImpl.deserialize(ReferenceableSerializerImpl.java:134) webservice.AddDates_Stub._deserialize_AddToDay(AddDates_Stub.java:489) webservice.AddDates_Stub._readFirstBodyElement(AddDates_Stub.java:458) com.sun.xml.rpc.client.StreamingSender._send(StreamingSender.java:158) webservice.AddDates_Stub.addToDay(AddDates_Stub.java:68) webservice.AddDatesServiceClient.adddatesserviceAddToDay(AddDatesServiceClient.java:19) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) java.lang.reflect.Method.invoke(Method.java:324) com.sun.rave.websvc.ui.ReflectionHelper.callMethodWithParams(ReflectionHelper.java:445) com.sun.rave.websvc.ui.TestWebServiceMethodDlg.invokeMethod(TestWebServiceMethodDlg.java:361) com.sun.rave.websvc.ui.TestWebServiceMethodDlg.access$500(TestWebServiceMethodDlg.java:55) com.sun.rave.websvc.ui.TestWebServiceMethodDlg$4.run(TestWebServiceMethodDlg.java:301) java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178) java.awt.EventQueue.dispatchEvent(EventQueue.java:454) java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201) java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151) java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145) java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137) java.awt.EventDispatchThread.run(EventDispatchThread.java:100)Hi Meera
This works fine in creator. I tested with a webservice having a method which returns java.util.date. I used the same code in that method to return java.util.Date. But the same method was returning a Calendar object instead of Date. So I added getTime() method to get the Date.
Can you post few lines of your code that you are writing in Creator.
Thanks
Creator Support -
What's wrong with java.util.Date type?
Hi!
When I try to persist object having field of type java.util.Date I get the
following SQL logged by Kodo with subsequent transaction rollback:
2002-11-14 15:03:35,099 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnecti
onFactoryImpl.supportcrm/kodo] INSERT INTO BILLY.TT_COMMENTS(COMMENT_TYPE,
TEXT,
CREATED_BY, ID, SUBJECT, CREATE_DATE, TT_MAIN_ID) VALUES (1, '1', 10, 279,
'1',
{ts '2002-11-14 15:03:35.059'}, 147)
When I change "{ts '2002-11-14 15:03:35.059'}" with "TO_DATE('2002-11-14
15:03', 'YYYY-DD-MM HH24:MI')" in SQL editor
and execute it everything works fine.
What does "{ts '..'}" mean? Is it a SQL generation error?
Thank you in advance.
Best regards,
Alexey MaslovI've created my own dictionary with dateToSQL() method overridden.
Now it works fine. But it's a kind of strange. Oracle is used often and my
JDBC drivers
are the most recent (at least, from the oracle.com).
Anyway, thank you again.
"Alexey Maslov" <[email protected]> wrote in message
news:[email protected]...
Patric,
Thank you for response.
We're using Oracle 8.1.7 via OCI driver from Oracle 9.2.
I've already tried 2.4.0 and it works fine there but I've found another
problem there
preventing me from using it. See my post in solarmetric.kodo.betanewsgroup.
>
"Patrick Linskey" <[email protected]> wrote in message
news:[email protected]...
That's odd -- what version of Oracle are you using?
Moving to Kodo JDO 2.4.0
(http://www.solarmetric.com/Software/beta/2.4.0) will almost certainly
get rid of this problem, as we use exclusively prepared statements in
it, and therefore pass dates etc. to JDBC as parameters.
But, to get things working with your Oracle database and Kodo JDO 2.3,
you could create your own extension of OracleDictionary and override the
dateToSQL() method to generate the appropriate TO_DATE() syntax. See our
documentation for more details on creating custom database dictionaries.
-Patrick
Alexey Maslov wrote:
I've added TRACE level logging for transactions in JBoss and got
original
exception:
NestedThrowables:
com.solarmetric.kodo.impl.jdbc.sql.SQLExceptionWrapper: [SQL=INSERT
INTO
BILLY.T
T_MAIN(TT_SOLUTION_ID, DELAY_REASON, TT_STATE_ID, ID, CONTACT_PHONE,
CANCEL_REAS
ON, OPER_DESCR, TT_TYPE_ID, CREATED_BY, EXP_CLOSE_DATE,SERV_OPEN_DATE,
OPEN_DAT
E, FLAGS, TAKEN_BY, TT_CAT_ID, SUBJECT_ID, SUBJECT, SERV_CLOSE_DATE)
VALUES
(NUL
L, NULL, 1, 439, NULL, NULL, '____________ ________________ ________________', 7, 5, {ts
'2002-11-14 1
8:38:16.075'}, NULL, {ts '2002-11-14 18:18:16.075'}, 0, NULL, 11,24099,
'1', NU
LL)] ORA-00904: invalid column name
at
com.solarmetric.kodo.impl.jdbc.runtime.SQLExceptions.throwFatal(SQLEx
ceptions.java:17)
at
com.solarmetric.kodo.impl.jdbc.runtime.JDBCStoreManager.insert(JDBCSt
oreManager.java:421)
at
com.solarmetric.kodo.runtime.datacache.DataCacheStoreManager.insert(D
ataCacheStoreManager.java:265)
at
com.solarmetric.kodo.runtime.StateManagerImpl.insert(StateManagerImpl
..java:1783)
atcom.solarmetric.kodo.runtime.PNewState.flush(PNewState.java:31)
at
com.solarmetric.kodo.runtime.StateManagerImpl.flush(StateManagerImpl.
java:372)
at
com.solarmetric.kodo.runtime.PersistenceManagerImpl.flush(Persistence
ManagerImpl.java:426)
at
com.solarmetric.kodo.ee.EEPersistenceManager.beforeCompletion(EEPersi
But when I try to execute the statement above against the database
manually
everything works fine.
I'm absolutely desperate!
P.S. On 2.4.0 RC the operation invoking this database insert completes
fine.
"Alexey Maslov" wrote in message
news:[email protected]...
Hi!
When I try to persist object having field of type java.util.Date I
get
the
following SQL logged by Kodo with subsequent transaction rollback:
2002-11-14 15:03:35,099 INFO
[com.solarmetric.kodo.impl.jdbc.ee.ManagedConnecti
onFactoryImpl.supportcrm/kodo] INSERT INTOBILLY.TT_COMMENTS(COMMENT_TYPE,
TEXT,
CREATED_BY, ID, SUBJECT, CREATE_DATE, TT_MAIN_ID) VALUES (1, '1',
10,
>>>
279,
'1',
{ts '2002-11-14 15:03:35.059'}, 147)
When I change "{ts '2002-11-14 15:03:35.059'}" with
"TO_DATE('2002-11-14
15:03', 'YYYY-DD-MM HH24:MI')" in SQL editor
and execute it everything works fine.
What does "{ts '..'}" mean? Is it a SQL generation error?
Thank you in advance.
Best regards,
Alexey Maslov
Patrick Linskey [email protected]
SolarMetric Inc. http://www.solarmetric.com
Best regards,
Alexey Maslov -
I can't cast java.util.Date to oracle.jbo.domain.Date
Hi, i have a variable "pippo" type java.util.Date formatted like (dd-MM-YYYY hh:mm:ss)
and I want insert in my Database where the field is Date type(oracle.jbo.domain.Date)
in the same format(dd-MM-YYYY hh:mm:ss).
I try to convert "pippo" but the result is formatted(dd-MM-YYYY hh:mm:ss).
Thank's a lot yours time and i'm very sorry for my easy english
Bye LucaHere is what i have seen that works , but does not preserve milliseconds. Does anyone have other solution? Using dateValue() looses hours, mins and seconds.
public oracle.jbo.domain.Date toJboDate(java.util.Date pJavaDate)
return new oracle.jbo.domain.Date(new Timestamp(pJavaDate.getTime()));
public java.util.Date toJavaDate(oracle.jbo.domain.Date pJboDate)
return new Date(pJboDate.timestampValue().getTime());
Chandresh
Maybe you are looking for
-
Standard Purchase Order XSL-FO
Hi, I'm trying to insert the requestors telephone number into the standard po template in the 'Deliver To: ' area of the document. The requestor name and email address is already seeded but I'm having difficulty identifying what should be used for th
-
How can I get flash videos to play
When I bought this iPad I had no idea that I wouldn't be able to watch most of the videos I want to watch. Is there any way to get flash without paying for a new web browser program?
-
[SOLVED] "The superblock could not be read..."
Good Evening. In the beginning, I want to apologise if my English isn't as correct and comprehensible as I want it to be. I am rather clueless Linux user with penchant for learning. I have used Slackware for some time, but I wanted to try out Arch be
-
I'm trying to set up roles for some users on AX 2012 but I can't seem to hide some Modules. Example: I give access to the User for Sale Order but Sale Order Menu Item exit in Accounts Receivable and 'Sales and marketing Module So how to hide Sales a
-
Trouble resizing layers to specific dimensions
Hello. I am using PSE 5 and I am trying to make an 11 x 8.5 brochure for my business, which will have a mixture of text and pictures. What I want to do is place four pictures in the brochure but the pictures, when dragged in, cover the whole brochure