The DescVal fields are getting truncated…
If I run this query in Squirrel
select classcd, descval1, length(trim(descval1)), length(descval1) from gndata.zdk01genlf
I get
CLASSCD DESCVAL1 Trim Len Untrim Len
91177 Auctioneers - sales conducted away from 39 40
But when I look at the results in my app it shows DESCVAL1 as unTrimmed length of 39.
Thanks
From: eclipselink-users-bounces@xxxxxxxxxxx [mailto:eclipselink-users-bounces@xxxxxxxxxxx] On Behalf Of Christopher Delahunt
Sent: Thursday, March 31, 2011 3:12 PM
To: EclipseLink User Discussions
Subject: Re: [eclipselink-users] Having issues with fields coming back trimmed in DB2
Hello Kevin,
Only thing I can think of is that you are persisting strings which are longer than the field definitions you have provided on your columns and DB2 might be silently truncating them. But you have not said what is getting trimmed, or what the values are in the database.
Best Regards,
Chris
On 31/03/2011 4:06 PM, Kevin Haskett wrote:
I am executing a query and I am getting trimmed values back in my String fields.
Here is what I have been using -
@Entity
@Table(name = "ZDK01GENLF", schema = "GNDATA")
public class Zdk01genlf implements Serializable {
@Column(name = "DESCVAL1", unique = true, nullable = false, length = 40)
private String descval1;
@Column(name = "DESCVAL2", unique = true, nullable = false, length = 40)
private String descval2;
@Column(name = "PREMBASE", unique = true, nullable = false, length = 2)
private String premiumBase;
@Column(name = "EXPBASE", unique = true, nullable = false, length = 5)
private String exposureBase;
@Column(name = "PREMSUBLN", unique = true, nullable = false, length = 3)
private String premiseOpsCovSubline;
// Fields
@EmbeddedId
private Zdk01genlfId id;
@Embeddable
public class Zdk01genlfId implements Serializable {
@Transient
private static final long serialVersionUID = 8557988537944379720L;
// Fields
@Column(name = "CLASSCD", unique = true, nullable = false, length = 8)
private String classcd;
@Column(name = "EFFDATE", unique = true, nullable = false, length = 8)
private String effdate;
@Column(name = "EXFDATE", unique = true, nullable = false, length = 8)
private String expdate;
}
And I execute this -
queryString = SELECT model FROM Zdk01genlf model WHERE UPPER(TRIM(FROM model.id.classcd)) LIKE :propertyValue and 20110331 >= model.id.effdate and 20110331 <= model.id.expdate order by model.descval1
From -
final Query query = this.em.createQuery(queryString);
query.setParameter("propertyValue", value);
return query.getResultList();
Any ideas why the values are trimmed?
Thanks,
Kevin
This message (including any attachments) is intended only for the use of the individual or entity to which it is addressed and may contain information that is non-public, proprietary, privileged, confidential, and exempt from disclosure under applicable law or may constitute as attorney work product. If you are not the intended recipient, you are hereby notified that any use, dissemination, distribution, or copying of this communication is strictly prohibited. If you have received this communication in error, notify us immediately by telephone and (i) destroy this message if a facsimile or (ii) delete this message immediately if this is an electronic communication. Thank you.
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
This message (including any attachments) is intended only for
the use of the individual or entity to which it is addressed and
may contain information that is non-public, proprietary,
privileged, confidential, and exempt from disclosure under
applicable law or may constitute as attorney work product.
If you are not the intended recipient, you are hereby notified
that any use, dissemination, distribution, or copying of this
communication is strictly prohibited. If you have received this
communication in error, notify us immediately by telephone and
(i) destroy this message if a facsimile or (ii) delete this message
immediately if this is an electronic communication.
Thank you.