Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how to use spaced column names in hibernate orderby mapping xml

 
Krishnaa Kumar
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi.,

I have a column name say USER IMAGE NAME. How to use this spaced column name in orderby attribute, to get sorted in descending order.

<map name="images" table="`USER IMAGE`" order-by="`USER IMAGE NAME` desc">
<key column="`USER ID`"/>
<index column="`USER IMAGE NAME`" type="string"/>
<element type="string" column="`USER IMAGE PATH`"/>
</map>
The code -- order-by="USER IMAGE NAME desc" not works.
 
Hemant Thard
Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Krishnaa ,

How are you initializing your map ?
 
Krishnaa Kumar
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I couldn't get your question.

The map was initialized by hibernate.
 
Hemant Thard
Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Krishnaa,

Hibernate doesn't initialize your map.
you have to initialize it yourself .. look into your bean class.
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!