So I tried to google out a better way to do it. What I gathered most is that for MySql, group_concat can achieve what I want. Unfortunately, it's not valid for Oracle. And, there are a lot discussions on Oracle forum on how to achieve the same effort through very complicated queries and I got lost about half way through.
Then I found this little post on wm_concat for Oracle. On my first tryout, I was able to get it working in my project.
In my hibernate mapping, instead of:
<setI used:
name="stylePhoneMap"
table="style_phone_map"
batch-size="5"
lazy="false"
cascade="none">
<key column="phone_id"/>
<one-to-many class="com.vzw.my.company.domain.phone.StylePhoneMap"/>
</set>
<propertyThe result of the formula will return as a CLOB in SQL Navigator. I would put a length attribute on the property if for fact the result will be a long String. But for my case, I know for sure I don't need to. All style names are concatenated as one String with comma as separator. No extra domain object, no extra Java code to convert the Set to a String. What a great trick!
name="style"
type="java.lang.String"
formula="(select wm_concat(a.style_name) from style a, style_phone_map b where a.style_id=b.style_id and b.phone_id = phone_id)"
insert="false"
update="false"
/>