-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: "Could not find a setter for property" exception
PostPosted: Fri Jul 11, 2008 5:47 am 
Newbie

Joined: Fri Jul 11, 2008 5:35 am
Posts: 4
Hi.

I don't want hibernate to persist criteriaType property, so I annotated getCriteriaType method with @Transient annotation. Here is the code:

@Entity
@DiscriminatorValue(value = "java.lang.String")
public class StringFilterCriteria extends FilterCriteria {
private static final long serialVersionUID = -1849845246809052465L;
private static final String TYPE = String.class.getName();

public StringFilterCriteria() {
this(new String[] { "" });
}

public StringFilterCriteria(String[] filterTemplates) {
this.filterTemplates = filterTemplates;
this.templatesCount = 1;
}

protected void validate(String[] newTemplates) throws FilterFormatException {
if (newTemplates.length != templatesCount)
throw new IllegalArgumentException("Incorrect parameters count");
}

@Transient
public String getCriteriaType() {
return TYPE;
}

public Criterion buildCriterion(String fieldName) {
Criterion criterion = Expression.like(fieldName, filterTemplates[0], MatchMode.EXACT);
return criterion;
}

public String buildWhereCondition(String fieldName, String persistetObjectQueryAlias, Map<String, QueryParameter> placeholders) {
StringBuilder whereStringBuilder = new StringBuilder(persistetObjectQueryAlias);
whereStringBuilder.append(".").append(fieldName);
whereStringBuilder.append(" like :").append(fieldName);
whereStringBuilder.append(" ");

placeholders.put(fieldName, new QueryParameter(fieldName, filterTemplates[0], QueryParameterType.STRING));

return whereStringBuilder.toString();
}

@Override
public void buildWhereClausePart(StringBuilder query, String persistetObjectFieldName, String persistetObjectQueryAlias, Map<String, Object> queryNamedParameterNameValueMap) {
query.append(persistetObjectQueryAlias).append(".").append(persistetObjectFieldName);
query.append(" like :").append(persistetObjectFieldName);
queryNamedParameterNameValueMap.put(persistetObjectFieldName, filterTemplates[0]);
}
}

But I'm retrieving the following exception:
Could not find a setter for property criteriaType in class ru.runa.af.presentation.filter.StringFilterCriteria

I have no idea about its cause and will be grateful for any help.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.