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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T18:07:56+00:00 2026-06-13T18:07:56+00:00

I have an Entity/JSF Managed Bean Ticket that represents a helpdesk ticket. It has

  • 0

I have an Entity/JSF Managed Bean Ticket that represents a helpdesk
ticket.

It has a status property; when the status is set to closed I want to
change the value of the closingDate property to the current system time.
But I think that code should be contained in the bean, as each time the
ticket is closed the time should be recorded.

What would be the proper way to manage it? I have several ideas.

  1. Make setter of creationTime private, and change its value when the
    status setter is called. Fast and quick, but makes a setter change two
    attributes. Also, forces me to use JPA field access (not much of a problem
    as I am already using it, but still a limitation) and I am not clear of
    what will happen when the bean is serialized.
  2. Make the status property a bound property as described in JavaBeans,
    and make the class a PropertyChangeListener to itself. Very formal, but
    a little overcomplicated to my likening.
  3. Make setters for both properties private, and add a non-bean method
    close() that performs both actions. I would go this way but it can make
    me it complicated to work with JSF.
  4. Do nothing. Keep the bean as dumb as it can and move the logic to the
    controller; cross my fingers hoping that nobody forgets to update both
    attributes.

I favour 1) or 3), but I would like to know if there is a better approach.

  • 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-13T18:07:58+00:00Added an answer on June 13, 2026 at 6:07 pm

    I don’t know if anyone can tell you the proper way to manage it, as arguments can be made for many different approaches just like you make them. To add to your list as a combination of 1) and 3), for example:

    • Have the setter of status update creationTime when it status is set to closed and leave both setters public. Has benefits from both as I’m not aware of any downside to this from a JPA perspective.

    What I would advice against however is having a Entity/JSF Managed Bean. I would recommend having two, an Entity bean and a JSF Managed Bean. This way your Entity bean can be kept as dumb as it can be, while your JSF Managed Bean will have smart methods like close() or reopen() and comprised of a series of dumb calls to the Entity bean. Also, you can do things like persist() in @PreDestroy. Easy to develop, easy to maintain, easy to make decisions. Hopefully you’ll find this helpful.

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

Sidebar

Related Questions

In my business model I have Entity class (IPoint interface ) that has a
I have 2 jsf pages, each of them have a managed bean. I'm navigating
I have entity Recipes and it has a HasMany collection comments. In a MVC
I have Entity Framework entities Events which have an EntityCollection of RSVP. I want
i have an entity Entity1 that have one to many relation with Entity2 as
I have an entity set bound to a DataGridView where users can add/modify rows.
I have a JSF converter that I use for a SelectItem list containing several
I have a stateless EJB that acceses my database. I need this bean in
I have a simple request scoped entity / pojo which has a Enum and
Suppose I have a JSF bean with @PostConstruct method. I would like to know

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.