Jump to content
  • java.sql.Date not a supported parameter type


    gcc
    Assigned User Giulio Toffoli
    CategoryFeature request
    PriorityNormal
    ReproducibilityAlways
    ResolutionOpen
    SeverityMajor
    StatusAssigned

    iReport supports java.sql.Timestamp and java.sql.Time but not java.sql.Date:

     

    Date does not appear in the drop-down list.

     

    If java.sql.Date is entered manually, then java.sql.Date objects passed as parameters from code work properly, but if the parameter is Prompting then iReport fails to convert it properly:

     

    java.lang.NoSuchMethodException: java.sql.Date.(java.lang.String)     at java.lang.Class.getConstructor0(Class.java:2706)     at java.lang.Class.getConstructor(Class.java:1657)     at com.jaspersoft.ireport.designer.compiler.prompt.Prompter$1.run(Prompter.java:230)     at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:199)     at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)     at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:104)     at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)     at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)     at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)     at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)     at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)     at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

     

    java.sql.Date.valueOf(String) can be used instead of a constructor in this case. Don't ask me why Sun didn't make a String constructor :)

     

    java.sql.Date is useful because none of the other options represent a date without a timestamp, e.g. one that can be chosen from a calendar. I could use a String, but I want to know the data type in my own code to perform the proper conversion and display a calendar control.

     

    This seems to make it impossible to use the same type with iReport and in my own code without some hacky workaround like a custom property.

     

    This has been previously reported on the forums, but not answered: http://jasperforge.org/plugins/espforum/view.php?group_id=83&forumid=101&topicid=59274


    Attachments: sql_date_test.jrxml

    User Feedback

    Recommended Comments

    There are no comments to display.


×
×
  • Create New...