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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T11:08:59+00:00 2026-05-24T11:08:59+00:00

I keep getting this exception: javax.el.PropertyNotFoundException: Property ‘message’ not found on type com.itworx.twitter.model.User when

  • 0

I keep getting this exception:

javax.el.PropertyNotFoundException: Property ‘message’ not found on
type com.itworx.twitter.model.User

when I try to run this code from my controller:

@RequestMapping(value="/profile", method=RequestMethod.GET)
    public ModelAndView goProfile(@ModelAttribute("user") User user){
        if(user != null){
            ModelAndView modelAndView = new ModelAndView("profile-layout");
            List< Message> messages=service.getUserMessages(user.getUsername());
            /*user.setMessages(messages);*/
            /*modelAndView.addObject("user",user);*/
            modelAndView.addObject("userMessages",messages);
            return modelAndView;
        }else{
            return new ModelAndView("register-layout");
        }

    }

the user bean is like this:

    @Entity
@Table(name="user")
public class User implements Serializable {

    /**
     * 
     */
    private static final long serialVersionUID = -5689970869179555442L;

    @Id
    @Column(name="username")
    /*@NotNull*/
    private String username;

    @Column(name="password")
    private String password;

    @Column(name="email")
    /*@Email*/
    private String email;

    @ManyToMany
    @JoinTable(name="user_follower",joinColumns={@JoinColumn(name="username")},
            inverseJoinColumns={@JoinColumn(name="follower")})
    private List<User> followers = new ArrayList<User>(0);

    /*@LazyCollection(LazyCollectionOption.FALSE)*/
    @OneToMany
    @JoinTable(name="user_message",joinColumns={@JoinColumn(name="username")},
            inverseJoinColumns={@JoinColumn(name="message_date")})
    @OrderBy(value="messageDate")
    private List<Message> messages = new ArrayList<Message>(0);

    public User() {

    }

    public String getUsername() {
        return this.username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return this.password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public void setUserFollowers(List<User> followers) {
        this.followers = followers;
    }

    public List<User> getUserFollowers() {
        return followers;
    }

    public void setMessages(List<Message> messages) {
        this.messages = messages;
    }

    public void addMessage(Message message){
        this.messages.add(message);
    }

    public List<Message> getMessages() {
        return messages;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

}

and the dao implementation is like this:

public List<Message> getUserMessage(String username) {
        session=sessionFactory.getCurrentSession();
        @SuppressWarnings("unchecked")
        List<Message> messages=session.createCriteria(User.class).setFetchMode("messages", FetchMode.JOIN)
        .add(Restrictions.eq("username", username)).list();
        return messages;
    }

the page is like this:

<body>
    <table id="feeds" style='width: 100%'>
    <tr></tr>
    </table>
    <table style='width: 100%'>
    <tr></tr>
        <c:forEach var="msg" items="${userMessages}">
            <tr>
                <td>
                    <c:out value="${msg.message}" />
                </td>
            </tr>
            <tr>
                <td>
                    <c:out value='${msg.messageDate}' />
                </td>
            </tr>
        </c:forEach>
    </table>
</body>
  • 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-24T11:09:00+00:00Added an answer on May 24, 2026 at 11:09 am

    Sorry, this reply is a week old so you’ve probably figured this out, but I think the problem is in your DAO implementation. This line:

    List<Message> messages=session.createCriteria(User.class)
            .setFetchMode("messages", FetchMode.JOIN)
            .add(Restrictions.eq("username", username)).list();
    

    Is actually going to give you back a list of User objects with the messages collection initialized.

    Changing the DAO method to this:

    session=sessionFactory.getCurrentSession();
    @SuppressWarnings("unchecked")
    User userWithMessages=session.createCriteria(User.class)
            .setFetchMode("messages", FetchMode.JOIN)
            .add(Restrictions.eq("username", username)).uniqueResult();
    return userWithMessages.getMessages();
    

    should give you (and probably gave you already) what you’re looking for.

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

Sidebar

Related Questions

i keep getting this error: Exception Details: System.NotSupportedException: Cannot serialize member HannaPrintsDataAccess.Customer.CustomerAddresses of type
I'm getting this exception Exception in thread main alice.tuprolog.InvalidTheoryException: The term part is not
I keep getting this NPE in my application and I can't seem to get
I'm trying to use slime from CVS (2009-01-05) but keep getting this error: LOAD:
I keep getting tasks that are above my skill level. How can I address this without coming accross as grossly incompetent?
I keep getting stuck conceptually on deciding an Exception-handling structure for my project. Suppose
Why do I keep on getting an exception-illegal operation on ResultSet? Here is the
I am trying to use Selenium RC but i keep getting this error whenever
I'm raising a Selnium-server (the jar), and getting this exception without trying to talk
I'm trying to use getServletContext().getRealPath( / ) , but I keep getting this error:

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.