0

Use of formula to concate fields

Suppose you have two fields holding firstname and lastname. And there is a property called fullname which is expected to hold the concatinated firstname and lastname. Then you have to do like follows...


Define a property called fullname in its class

Then in .hbm file, put a porperty like

<property name="fullName" formula="concat(FIRST_NAME,
LAST_NAME)"/>



Remember: FIRST_NAME and LAST_NAME are the database field name and not the class properties. Only two fields can be concatinated. No. of arguments mismatched exception may occur if more than two fields are concatinated.


|

0 Comments

Copyright © 2009 So That I Can Remember All rights reserved. Theme by Laptop Geek. | Bloggerized by FalconHive.