• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to get the table column name as key of the hasmap and values as arraylist in hibernate

 
suren kumar
Greenhorn
Posts: 5
Hibernate Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i want to store the table column name as key of hashmap and the fields under column as arraylist by using hibernate

code must be generic in getting those key and values from database ..

map<String,arraylist>


 
ntumba lobo
Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
with hibernate you can access the database metadata via the sessionFactory.
You have methods like getAllClassMetadata() or getClassMetadata(Class entityClass)

They will help you to do what you want or with a bit of luck they may even return straight away the metadata in the format that you expect !
 
suren kumar
Greenhorn
Posts: 5
Hibernate Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
my need is

table1 table2
name mark1 mark2 name mark1 mark2

xxxx 90 99 xxxx1 98 98
yyyy 90 99 yyyy1 98 98
zzzzz 90 zzzz1 98 98

i want to get number of feilds in column 1 in table 1 and table 2

and i will do the calculations as ((no of field in column1 in table1/no field in column1 in table2)*100)

such a way i wat to calculate it for all the columns continously...


please help me

 
ntumba lobo
Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not sure I understand what you mean by
i want to get number of feilds in column 1 in table 1


Are you saying you have multiple values in one column ?
If that's the case it is a very suspicious database design and maybe you should normalize your database structure before solving your calculation problem.
It may even make things a lot easier for you.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic