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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T14:39:17+00:00 2026-05-14T14:39:17+00:00

I have a class like this : import java.io.*; import java.util.*; public class Contact_Info_Entry

  • 0

I have a class like this :

import java.io.*;
import java.util.*;

public class Contact_Info_Entry implements Serializable
{
  public static final long serialVersionUID=26362862L;
  String Contact_Id,First_Name="",Last_Name="",Company_Name="",Branch_Name="",Address_1="",Address_2="",City="",State="",Zip="",Country="",E_Mail="",Phone;
  int I_1,I_2;
  float F_1,F_2;
  boolean B_1,B_2;
  GregorianCalendar Date_1, Date_2;
  Vector<String> A_Vector=new Vector<String>();

  public Contact_Info_Entry() { }

......
}

If I want to translate it to a class for JDO, do I need to define each field by it self or can I do a group at a time ?

For instance do I have to make it like this :

@PersistenceCapable(identityType=IdentityType.APPLICATION)
public class Contact_Info_Entry implements Serializable
{
  @PrimaryKey
  @Persistent(valueStrategy=IdGeneratorStrategy.IDENTITY)
  private Long id;
  @Persistent
  public static final long serialVersionUID=26362862L;
  @Persistent
  String Contact_Id;
  @Persistent
  String First_Name;
  @Persistent
  String Last_Name;
......
  @Persistent
  int I_1;
  @Persistent
  int I_2;
...
  @Persistent
  float F_1;
...
  @Persistent
  boolean B_1;
  @Persistent
  boolean B_2;
  @Persistent
  GregorianCalendar Date_1;
...
  @Persistent
  Vector<String> A_Vector=new Vector<String>();

  public Contact_Info_Entry() { }

......
}

Or can I do a group at a time like this :

@PersistenceCapable(identityType=IdentityType.APPLICATION)
public class Contact_Info_Entry implements Serializable
{
  @PrimaryKey
  @Persistent(valueStrategy=IdGeneratorStrategy.IDENTITY)
  private Long id;
  @Persistent
  public static final long serialVersionUID=26362862L;
  @Persistent
  String Contact_Id,First_Name,Last_Name="";
......
  @Persistent
  int I_1=0,I_2=1;
...
  @Persistent
  float F_1;
...
  @Persistent
  boolean B_1,B_2;
  @Persistent
  GregorianCalendar Date_1;
...
  @Persistent
  Vector<String> A_Vector=new Vector<String>();

  public Contact_Info_Entry() { }

......
}

Or can I skip the “@Persistent” all together like this :

import java.io.*;
import java.util.*;

@PersistenceCapable(identityType=IdentityType.APPLICATION)
public class Contact_Info_Entry implements Serializable
{
  public static final long serialVersionUID=26362862L;
  String Contact_Id,First_Name="",Last_Name="",Company_Name="",Branch_Name="",Address_1="",Address_2="",City="",State="",Zip="",Country="",
         E_Mail="",Phone;
  int I_1,I_2;
  float F_1,F_2;
  boolean B_1,B_2;
  GregorianCalendar Date_1, Date_2;
  Vector<String> A_Vector=new Vector<String>();

  public Contact_Info_Entry() { }

......
}

Which are correct ?

Frank

  • 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-14T14:39:17+00:00Added an answer on May 14, 2026 at 2:39 pm

    You do NOT need to annotate every field with @Persistent. The vast majority of types (primitives, their wrappers, String etc etc) are by default persistent. Just write your class as your class ought to be. Read
    http://www.datanucleus.org/products/accessplatform_1_1/jdo/types.html

    You can’t persist static fields
    http://www.datanucleus.org/products/accessplatform_1_1/jdo/fields_properties.html

    Google’s docs usage of @Persistent on everything is totally misleading

    As for declarations of multiple fields on the same line and whether the annotation applies to all, I would assume that the compiler will apply the annotation to all fields on that line, but that is to do with Java and how the compiler implements annotations rather than anything specific to JDO.

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

Sidebar

Ask A Question

Stats

  • Questions 492k
  • Answers 492k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Thanks everyone for the great answers which I have up-voted,… May 16, 2026 at 10:31 am
  • Editorial Team
    Editorial Team added an answer There is no single best answer, it depends on a… May 16, 2026 at 10:31 am
  • Editorial Team
    Editorial Team added an answer I think #linkToMenu needs to have a width assigned to… May 16, 2026 at 10:31 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

import java.io.*; import java.util.*; public class Sort { public static void main(String[] args) throws
import java.util.Collection; import example.Event; public interface Query { public boolean hasMore (); public Collection<Event>
I'm trying to create an EJB factory class, which works like this: You have
I have code which needs to do something like this There is a list
Why cant JLabel in java swing be declared inside the inner class like JMenu
I have a package of plug-in style modules. It looks like this: /Plugins /Plugins/__init__.py
I'm working on a class project to build a little Connect4 game in Java.
I have a Java servlet running on my notebook with Windows Vista, I set
I have a method fetchObjects(String) that is expected to return an array of Contract
OK I have so much questions regarding my file sharing application that I don'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.