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 7603067
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T23:34:27+00:00 2026-05-30T23:34:27+00:00

I having problem marshaling an iterator of objects using JAXB User class: @XmlRootElement(name=User) public

  • 0

I having problem marshaling an iterator of objects using JAXB

User class:

@XmlRootElement(name="User")
public class User{
    private Long id;
    private String name,mailid;
    private boolean isActive;
    public Long getId() {

        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getMailid() {
        return mailid;
    }
    public void setMailid(String mailid) {
        this.mailid = mailid;
    }
    public boolean isActive() {
        return isActive;
    }
    public void setActive(boolean isActive) {
        this.isActive = isActive;
    }

}

Function which return’s an Iterator of User :

public static Iterator<User> mapDoToUserObject(DataObject dao){

    final Iterator<Row> userRow = getRow(dao,USER.TABLE);


    return new Iterator<User>() {
        @Override
        public boolean hasNext() {
            return userRow.hasNext();
        }

        @Override
        public User next() {
            Row user = userRow.next();
            User user = new User();
            user.setId((Long)user.get(USER.USER_ID));
            user.setName((String) user.get(USER.FIRST_NAME));
            user.setMailid((String)user.get(USER.EMAIL_ID));
            return user;
        }

        @Override
        public void remove() {
            throw new UnsupportedOperationException("Remove not supported");

        }
    };  
}

How to marshal an iterator of Users using JAXB ?

  • 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-30T23:34:29+00:00Added an answer on May 30, 2026 at 11:34 pm

    You’ll either need to drain the iterator into a collection and then marshal that (which is the easiest solution), or else use JAXB’s incremental marshalling feature, which means iterating over the iterator yourself and marshalling the individual objects. For a description on how to do that, see Can JAXB Incrementally Marshall An Object?

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

Sidebar

Related Questions

I´m having problem using validation on DropDownListFor ... My Model : public class User
Having problem reading bytearray of custom objects. Any help is appreciated public class CustomObject
m having problem in operating on richtextbox from another class m using backgroundworker class
I am having problem in getting reference of Ajax control extender using $find() or
I'm having problem restricting a query in mdx, using except function at where clause.
I'm having a problem passing pointers to native code using COM. I want to
I'm having problem with my class. I'm going to make comparision operators of my
hi I'm having problem with my database. I'm using access as my database and
I am having problem transforming xml to xml using xsl. I found out where
Im having problem with single value inserts. Using pyodbc LL= [] .... sqla =

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.