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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T07:34:33+00:00 2026-05-31T07:34:33+00:00

I’m trying to get my tapestry value encoder to work with a hibernate composite

  • 0

I’m trying to get my tapestry value encoder to work with a hibernate composite key. I have the following code and I’m trying to get the composite id and pass it to the interface where it could later be sent back to the server for decoding back to an object.

@Embeddable
public class IfasvVendorPK implements Serializable{

    @Column(length = 4, nullable = false)
    protected String peId;
    @Column(length = 8, nullable = false)
    protected String peAddrCd;

    public IfasvVendorPK() {
    }

    public IfasvVendorPK(String peId, String peAddrCd) {
        this.peId = peId;
        this.peAddrCd = peAddrCd;
    }
    // equals, hashCode
}

@Entity
public class IfasvVendor implements Serializable {

    @EmbeddedId
    private IfasvVendorPK ifasvVendorPK;

    //...
} 

The following is my value encoder. The toClient is where would I need to send the composite key to the interface. I’m not sure how to get the composite key.

@SuppressWarnings("unchecked")
public LabelAwareValueEncoder getEncoderVendor() {
    return new LabelAwareValueEncoder<IfasvVendor>() {

        public String toClient(IfasvVendor value) {
            return value.getIfasvVendorPK().toString();
        }

        public IfasvVendor toValue(String clientValue) {
            if (clientValue.isEmpty()) {
                return null;
            }

            return (IfasvVendor) session.get(IfasvVendor.class, clientValue);
        }

        public String getLabel(IfasvVendor value) {
            return value.getPeNameU();
        }
    };
}  

If someone could help me to better understand how to work with the composite key so I could get my value encoder working, it would be greatly appreciated. Thanks in advance.

  • 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-31T07:34:34+00:00Added an answer on May 31, 2026 at 7:34 am

    Hibernate has no way to know how what this string means and cannot convert it back.
    I suggest adding a non-composite ID or concaternate the values which you then split again in your toValue method.

    If you keep the ValueEncoder longer than your request (ex. with @Persist) you could put a HashMap in it to easily get the object back for a concaternated client key;

    Since your Composite key is serializeable you could serialize it in toClient and deserialize it in toValue. However, I really wouldn’t do that, serializing stuff and sending it to a browser and back is a big, evil security hole.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I am trying to loop through a bunch of documents I have to put
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
Basically, what I'm trying to create is a page of div tags, each has
I am trying to understand how to use SyndicationItem to display feed which is
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
this is what i have right now Drawing an RSS feed into the php,

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.