Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3427826
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T06:53:05+00:00 2026-05-18T06:53:05+00:00

I have the following simple entity: package net.plus.msodb.model; import java.io.Serializable; import javax.persistence.Column; import javax.persistence.Entity;

  • 0

I have the following simple entity:

   package net.plus.msodb.model;

    import java.io.Serializable;

    import javax.persistence.Column;
    import javax.persistence.Entity;
    import javax.persistence.Id;
    import javax.persistence.Table;

    @Entity
    @Table(schema="msodb", name="mso")
    public class Mso implements Serializable {
 @Id
 private Integer incidentReference;

 private String detectedDate;
 private String detectedTime;
 private String startDate;
 private String startTime;
 private String anticipatedClearDate;
 private String anticipatedClearTime;
 private String actualClearDate;
 private String actualClearTime;
 private String headline;
 private String progress;
 private String details;
 private String servicesType;
 private String servicesCount;

 public Mso() {
 }

 @Column(name="detectedDate")
 public String getDetectedDate() {
  if(detectedDate == "") {
   return null;
  }

  return detectedDate + " " + detectedTime;
 }

        /*
         * Getters & Setters removed to save space
         */

 @Column(name="detectedDate")
 public void setDetectedDate(String detectedDate) {
  this.detectedDate = detectedDate;
 }

 public void setStartDate(String startDate) {
  this.startDate = startDate;
 }

 public void setAnticipatedClearDate(String anticipatedClearDate) {
  this.anticipatedClearDate = anticipatedClearDate;
 }

 public void setActualClearDate(String actualClearDate) {
  this.actualClearDate = actualClearDate;
 }

    }

and this is Smooks the config I’m using:

<?xml version="1.0" encoding="UTF-8"?><smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd" xmlns:jb="http://www.milyn.org/xsd/smooks/javabean-1.2.xsd">
  <params>
    <param name="stream.filter.type">SAX</param>
    <param name="inputType">input.xml</param>
    <param name="input.xml" type="input.type.actived">Workspace://MSODBActions/src/test/resources/msos.xml</param>
  </params>
  <jb:bean beanId="Mso" class="net.plus.msodb.model.Mso" createOnElement="/msos/mso">
    <jb:value data="/msos/mso/@actualClearDate" property="actualClearDate"/>
    <jb:value data="/msos/mso/@actualClearTime" property="actualClearTime"/>
    <jb:value data="/msos/mso/@anticipatedClearDate" property="anticipatedClearDate"/>
    <jb:value data="/msos/mso/@anticipatedClearTime" property="anticipatedClearTime"/>
    <jb:value data="/msos/mso/@details" property="details"/>
    <jb:value data="/msos/mso/@detectedDate" property="detectedDate"/>
    <jb:value data="/msos/mso/@detectedTime" property="detectedTime"/>
    <jb:value data="/msos/mso/@headline" property="headline"/>
    <jb:value data="/msos/mso/@incidentReference" decoder="Integer" property="incidentReference"/>
    <jb:value data="/msos/mso/@progress" property="progress"/>
    <jb:value data="/msos/mso/@servicesCount" property="servicesCount"/>
    <jb:value data="/msos/mso/@servicesType" property="servicesType"/>
    <jb:value data="/msos/mso/@startDate" property="startDate"/>
    <jb:value data="/msos/mso/@startTime" property="startTime"/>
  </jb:bean>
</smooks-resource-list>

When I try and save the entity, I get the following error:

Data truncation: Incorrect datetime value: '' for column 'detectedDate' at row 1

You can see from the getter for detectedDate that if the detectedDate is an empty string (which it is if that attribute is missing from the source XML for the Smooks transformation) then the getter should return null.

Debugging this part of the code it does indeed return null.

It’s almost like the getter isn’t being used to get the value for detectedDate. If it were it would either be null, or at least a single space string.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T06:53:05+00:00Added an answer on May 18, 2026 at 6:53 am

    In answer to my own question, the problem comes from the fact you can only annotate the member definitions or the methods, but not both. Notice I had annotated the @Id member variable & put the other annotations on the methods.

    Move the @Id annotation to the getter for that field to solve the problem.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am following a simple ADO.NET Entity/MVC 2 tutorial wherein my Views are created
I have created a very simple Entity Framework 4.0 model using VS2010 Professional. Ignore
I have a simple question regarding Entity declaration in JPA. I have an entity
In my domain model I have following Classes.A 'UserProfile' has one 'SecurityPrincipal' class SecurityPrincipal{
With the following simple relational database structure: An Order has one or more OrderItems,
I have following class, I need to get type in constructor, how can I
I've got a very simple Entity Framework project with POCO Entities . I've got
I am trying to get a simple example up and running using JPA in
i have installed lxml2.2.2 on windows platform(i m using python version 2.6.5).i tried this
Forgive me if this has been asked before; I did a search but couldn't

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.