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

  • SEARCH
  • Home
  • 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 8940279
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T10:59:56+00:00 2026-06-15T10:59:56+00:00

I found something pretty peculiar, and probably insignificant. When you define in an XSD

  • 0

I found something pretty peculiar, and probably insignificant. When you define in an XSD an Element with the type xs:long, and you don’t set minOccurs="0", and you run it through JAXB, the resulting element is of type long. However, when you do set minOccurs="0" in the XSD element, the resulting element is of type Long. Notice the difference between the long and Long DataType

Now, with the work I do, I do some if (thisVariable == null) tests, and naturally, long cannot be null. Long can.

*What I would like to know, is this a bug in JAXB which causes this difference between the resulting variables, or is it intended for these resulting variables to come out the way they do? *

Here was the files I used to test with:

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<xs:schema id="ReportRequestWrapper" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
  <xs:element name="ReportRequestWrapper">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="queryId" type="xs:long" minOccurs="0" />
        <xs:element name="reportId" type="xs:long" minOccurs="0" />
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

queryId and reportId came out as follows:

public class ReportRequestWrapper {

    protected Long queryId;
    protected Long reportId;

If I omitted the MinOccurs=”0″,

        <xs:element name="queryId" type="xs:long"  />
        <xs:element name="reportId" type="xs:long"  />

The result turned into

public class ReportRequestWrapper {

    protected long queryId;
    protected long reportId;

I just found this pretty curious and wanted some more information on this one.

  • 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-06-15T10:59:57+00:00Added an answer on June 15, 2026 at 10:59 am

    No this is not a bug because when you say minOccurs = "0" which means that there is a possibility that queryId may be present or not.

    So as you said long cannot be null, so the case that it is not present cannot be simulated without Long.

    And when you don’t specify minOccurs = "0" this means that no matter what the value (other that null i.e. not present), queryId would be present. So this case is satisfied totally with long and does not require Long.

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

Sidebar

Related Questions

I make pretty extensive use of PImpl and something that I've found myself waffling
I was playing around with include and extend today and found something I don't
I know I am probably missing something pretty basic here, but I am trying
This is probably a pretty basic question, but just something that I wanted to
Recently found something peculiar in a filter, I can't believe its intended behaviour. from
I am getting started with Django and I found something I don't understand very
I found something like this in a SqlServer DB stored proc: SELECT stuff FROM
I found something that works with updating one field at here: http://www.karlrixon.co.uk/articles/sql/update-multiple-rows-with-different-values-and-a-single-sql-query/ UPDATE person
I have just found something very weird while developing a website. While trying to
I'm learning asp.net mvc and found something interesting: It seems that I can't explicitly

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.