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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T05:53:36+00:00 2026-06-17T05:53:36+00:00

I have an @Entity as @Entity @Table(name = variable) @XmlRootElement public class Variable {

  • 0

I have an @Entity as

@Entity
@Table(name = "variable")
@XmlRootElement
public class Variable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private long id;

    @Column(unique = true, nullable = false)
    private String name;

    @Column
    @Enumerated(EnumType.STRING)
    private VariableType type;

    @Column(nullable = false)
    private String units;

    @Column
    private String description;

    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "created_on", nullable = false)
    private Date createdOn;

    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "retired_on", nullable = true)
    private Date retiredOn;

    @Column(nullable = false)
    private boolean core;

    public Variable(@Nonnull final String name,
                    @Nonnull final VariableType type,
                    @Nonnull final String units,
                    @Nonnull final String description,
                    @Nonnull final Date createdOn,
                    @Nonnull final boolean core) {
        this.name = name;
        this.type = type;
        this.units = units;
        this.description = description;
        this.core = core;
        this.createdOn = createdOn;
    }

    @Nonnull
    public long getId() {
        return id;
    }

    @Nonnull
    public String getName() {
        return name;
    }

    @Nonnull
    public VariableType getType() {
        return type;
    }

    @Nonnull
    public String getUnits() {
        return units;
    }

    @Nullable
    public String getDescription() {
        return description;
    }

    @Nonnull
    public Date getCreatedOn() {
        return createdOn;
    }

    @Nonnull
    public Date getRetiredOn() {
        return retiredOn;
    }

    @Nonnull
    public boolean isCore() {
        return core;
    }

    @Override
    public String toString() {
        return new StringBuilder().
                append("id="+id+" ").
                append("name="+name+" ").
                append("type="+type+" ").
                append("units="+units+" ").
                append("description="+description+" ").
                append("createdOn="+createdOn+" ").
                append("retiredOn="+retiredOn+" ").
                append("core="+core+" ").
                toString();
    }
}

and a VariableManager which creates the @Entity instance

public Variable createVariable(@Nonnull final String name,
                                   @Nonnull final VariableType type,
                                   @Nonnull final String units,
                                   @Nonnull final String description,
                                   @Nonnull final boolean core) {
        final Variable variable =  variableCrudService.create(new Variable(name, type, units, description, new Date(), core));
        LOGGER.info("added variable - ", variable);
        return variable;
    }

When I execute this, I get logging information as

14:18:12,320 INFO  [org.jboss.resteasy.cdi.CdiInjectorFactory] (http--127.0.0.1-8080-4) Found BeanManager at java:comp/BeanManager
14:18:13,336 INFO  [com.bb.business.VariableManager] (http--127.0.0.1-8080-4) added variable - 

I do not know why toString doesn’t print the state of the object even though I can see that the Variable is created in database.

  • 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-17T05:53:37+00:00Added an answer on June 17, 2026 at 5:53 am

    From your code, I can’t tell what type of logger you are using (based on the method signature of info(), it does not appear to be a log4j nor a java.util logger), but I suspect that calling

    LOGGER.info("added variable - " + variable);
    

    instead of

    LOGGER.info("added variable - ", variable);
    

    (note the plus sign instead of the comma) may do it.

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

Sidebar

Related Questions

Hi every one I have these classe @Entity @Table(name = login, uniqueConstraints={@UniqueConstraint(columnNames={username_fk})}) public class
I have the following mapping: @Entity @Table(name = Prequalifications) public class Prequalification implements Serializable
I have this piece of code: @Entity @Table(name = MOVERS) public class MOVers implements
I have code like: @Entity @Table(name = A) @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) public class A
I have this code @Entity @Table(name = picture) public class Picture implements Serializable {
Suppose I have an entity like this: @Entity @Table(name = ITEMS) public class Item
I have an entity like this: @Entity @Table(name = PLATFORM) public class Platform{ @Id
I have this class @Entity @Table(name = DB.APPL_SESSION) @AttributeOverrides({@AttributeOverride(name = id, column = @Column(name
I have an JPA entity like this: @Entity @Table(name = category) public class Category
Using JPA and Hibernate I have an entity class @Entity @Table(name = "ROLES") public

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.