java


How to use Transformers.aliasToBean(Class) with ArrayList?


I am ussing hibernate and I'm trying to make something.
This is my class:
public class TeamLeaderJOBscalar {
public ArrayList<Integer> mySubordinates;
public TeamLeaderJOBscalar(){
}
public ArrayList<Integer> getMySubordinates() {
return mySubordinates;
}
public void setMySubordinates(ArrayList<Integer> mySubordinates) {
this.mySubordinates = mySubordinates;
}
}
and I want to use it here:
int idEmp = 22;
String myTeam = "select emp.id_emp as mySubordinates from employee emp"
+ "inner join lead on lead.lead= emp.id_emp "
+ "where lead.leadBoss= :idGBSUser ";
Query simpleSQL = session.createSQLQuery(myTeam)
.addScalar("mySubordinates", Hibernate.OBJECT)
.setParameter("idGBSUser", idEmp)
.setResultTransformer(Transformers.aliasToBean(TeamLeaderJOBscalar.class));
#SuppressWarnings("unchecked")
List<TeamLeaderJOBscalar> rezQuery = simpleSQL.list();
ArrayList<Integer> myTeamForTL = new ArrayList<Integer>();
for (TeamLeaderJOBscalar item : rezQuery) {
myTeamForTL = item.getMySubordinates();
}
I don't know what to use in this line:
.addScalar("mySubordinates",Hibernate.OBJECT).
I want to print the result in that foreach. Is this working on collections too?...I mean, I recently used something like this, but in bean classes I had simple attributes like string, int and I've used: .addScalar("name", Hibernate.STRING), etc. But now, I want a list. The result of that query returns me more than one record (it returns some ids), and i want to put them in a list...so I can send it to another class.

Related Links

Java Code Signing Without Private/Public Keys
Could not load .GPX file in Android Emulator Control (Android Debug Monitor)
NullPointerException When Entering Data Into a Dynamic Array from Text File
Java counting method? [closed]
How to draw an Epitrochoid with methods
my JPanel refuses to be focused
Java regExp get sub-sting before last quote
Weird ActivityNotFoundException for class in a library project
How to iterate JSON data in Android [closed]
Self bounded generics
How to upload audio in soundcloud via my app and i want to send that id also to my server
How to implement rewriting in tomcat 7
Exchange of information between two Web Applications [closed]
How to serve files from outside context using Tapestry5
GAE app not displaying in Firefox
responsive Google Chart with GWT

Categories

HOME
openlayers
pypi
gerrit
fluentd
plot
homebrew
stock
raspberry-pi
fme
sd-card
youtube-dl
gis
packages
v8
jxls
binary-tree
alpha
awesome-wm
maude-system
kibana-4
facebook-php-sdk
floating-action-button
numeral.js
alignment
gz
percona
lombok
pc
database-replication
pythonanywhere
visual-composer
autocad-plugin
paging
zurb-foundation-6
tibco-mdm
smb
fish
rst2pdf
log4js-node
webkitspeechrecognition
srcset
iframe-resizer
ioio
code-contracts
mpmediaquery
bytecode-manipulation
service-discovery
c11
mapzen
core-plot
elmah
mime
executenonquery
dotcover
upstart
jlink
tropo
font-size
akka-cluster
pdfclown
webdriverjs
account-kit
vtigercrm
synchronous
messenger
angular-strap
firmata
color-picker
url-masking
fuzzy-search
actionbardrawertoggle
pickadate
bluemix-app-scan
freelancer.com-api
icu4j
method-parameters
unity5.2.3
inmobi
jsapi
nsbutton
java-metro-framework
websocket4net
openexr
article
typeof
tld
expected-exception
doskey
comexception
srs
mbr
soundtouch
dataadapter
mylyn
frameset
cascalog
regsvr32
postgresql-performance
data-loss
servicehost
krl
revisions
dentrix
castle-monorail
zend-tool

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App