Time |
S |
Nick |
Message |
00:04 |
|
|
H4ml3t joined ##javaee |
00:10 |
|
pdurbin |
to see how jdbc is implemented |
01:09 |
|
|
kotten joined ##javaee |
01:11 |
|
kotten |
anyone awake with jdbc experience? |
01:47 |
|
sfisque |
sure kotton |
01:51 |
|
kotten |
sfisque: always up for it =) |
01:51 |
|
sfisque |
lolz |
01:51 |
|
kotten |
sfisque: seriously half-man half-bot? =) |
01:51 |
|
kotten |
well to my problem.. |
01:51 |
|
sfisque |
lolz, you just got lucky |
01:51 |
|
sfisque |
i happenbed to come back from afk about 2 min after you asked |
01:52 |
|
kotten |
I see you are often helpfull to people here |
01:52 |
|
kotten |
anyway.. |
01:52 |
|
kotten |
I am using mysql and JDBC and populate a javafx stage with data from databases |
01:54 |
|
kotten |
I have some problem understanding how to get the hm.. not metadata for the db but metadata for a specific table |
01:54 |
|
kotten |
like domains used and if its a primary key |
01:54 |
|
kotten |
I have no problems getting the tables "names" but i want the other info |
01:57 |
|
kotten |
I get the databasemetadata from the connection using .getMetaData(). getTables(null?, null?, %, null) into a resultset |
01:57 |
|
kotten |
then while this set has next i user .getString(3) |
01:57 |
|
kotten |
and this gives me the name of every table |
02:00 |
|
sfisque |
right |
02:01 |
|
sfisque |
once you get the resultset you acall rs.getMetaData()… which returns metadata for the specific result sset |
02:01 |
|
sfisque |
getMetaData exists as a method at several context levels for jdbc |
02:02 |
|
kotten |
okay |
02:02 |
|
kotten |
but what i would like to do is like "Describe <specific table>" |
02:03 |
|
kotten |
giving me field, type, if null, if key is primary and default |
02:04 |
|
kotten |
but hm.. okay |
02:05 |
|
kotten |
i guess i could run Describe (specified table) and use it as a normal query result |
02:05 |
|
sfisque |
gotcha. i did that a very long time ago (we had to, back in the day before ORMs came into existance if you wanted to write modular jdbc code) taking a look at the javadoc to refresh my memory |
02:05 |
|
kotten |
ORMs? |
02:06 |
|
sfisque |
hibernate, toplink, ibatis, etc. |
02:06 |
|
sfisque |
object relational models |
02:06 |
|
kotten |
hibernate is the only thing i ever recognize there :) |
02:06 |
|
sfisque |
so yeah, the way to do it is to run a limited select * from the table, then get teh ResultSetMetaData and that will give you all the column information |
02:07 |
|
kotten |
yeah sound sane |
02:07 |
|
kotten |
those tools you listed are intended to get an overview of a DB? |
02:08 |
|
sfisque |
no, they allow you to treat the sql repository as if it were serving up "object graphs" rather than raw resultsets |
02:08 |
|
kotten |
ohh... |
02:09 |
|
sfisque |
so something like statement.execute( "select * from TABLE_NAME limit 1" ); |
02:10 |
|
sfisque |
and then resultset.getMetaData() to get the metadata and use that to introspect the table in question |
02:10 |
|
|
[[thufir]] joined ##javaee |
02:11 |
|
kotten |
okay, thanks for your help =) |
02:11 |
|
sfisque |
the limit saves you from retrieving a potentially HUGE table just to get the metadata. the "limit" is mysql specific and way to do that is proprietary for each db (sqlserver uses "top x…:" and oracle requires you to sandwich the query inside to outter queries that trim the first X and the last Y when you're doing paging |
02:12 |
|
sfisque |
npnp kotten |
02:12 |
|
sfisque |
the bill is in the mail :P |
02:12 |
|
kotten |
=) |
02:13 |
|
kotten |
what do you do for a living? |
02:14 |
|
sfisque |
i trick people into paying me lots of money sitting on my butt. otherwise known as an enterprise java engineer :P |
02:14 |
|
kotten |
That sounds like a dream :) |
02:15 |
|
sfisque |
i'm one of the few people in the world that has used java since it came out, and didn't jump ship when the whole .NET things first reared its ugly head |
02:15 |
|
sfisque |
:P |
02:16 |
|
kotten |
well, i myself started with C# and went to java |
02:17 |
|
* sfisque |
comforts kotten and hands him a warm cocoa |
02:17 |
|
sfisque |
at least you recovered :P |
02:17 |
|
kotten |
haha, you mean its a bad choice? |
02:17 |
|
kotten |
well.. seriously.. |
02:18 |
|
sfisque |
no, you recovered from the m$ brainwashing to wake up and escape |
02:18 |
|
kotten |
haha =) aa.. |
02:18 |
|
sfisque |
:-D |
02:18 |
|
sfisque |
i liken the m$ platform like the plato parable about the shadow puppets in the cave |
02:18 |
|
kotten |
There are multiple reasons why i prefer java(and I see many application fields were .net could be better) |
02:18 |
|
kotten |
However after javafx there is no turning back that i really really like |
02:19 |
|
sfisque |
of course. if you're in a "closed m$ shop" .NET makes total sense |
02:19 |
|
sfisque |
i really have to try out jfx |
02:19 |
|
sfisque |
i've done flex and back in the day i did raw awt and swing stuff |
02:19 |
|
kotten |
Do it! Its wonderful. |
02:19 |
|
sfisque |
from what i gather, jfx is very "flex like" |
02:20 |
|
kotten |
yeah atleast the "real" jfx 2.0 + the one that is built in now |
02:20 |
|
kotten |
speaking of .net i have to comment an incident that happend today |
02:21 |
|
kotten |
My friend and i were working on this assignment using C# as he prefered that over java |
02:21 |
|
sfisque |
the funny thing is, back around 2000 ibm created a framework called xbeans, that allowed you to bootstrap your UI from xml and wire it up with a very versatile delegate model. basically flex before flex existed |
02:21 |
|
sfisque |
i would bet good money that some ibm devs were working at adobe when they developed flex. |
02:22 |
|
sfisque |
** ex-ibm |
02:22 |
|
sfisque |
you have my condolences :-P |
02:22 |
|
kotten |
So i had to install visual studio => but couldn't because it requiered Internet explorer.. So i try to install IE win update crashes and gives me an error that is not listed on the msdn.. |
02:23 |
|
kotten |
And the reason that i pressume this happens is because i manually removed it because i didn't want it months ago |
02:23 |
|
kotten |
Thanks =) |
02:23 |
|
sfisque |
yah, m$ tools are like the borg, you can't just do it a little, installing one piece begins the re-assimiliation process |
02:24 |
|
kotten |
hahaha :D |
02:24 |
|
sfisque |
we are microsoft….. you will be assimilated…. resistance is futile.... |
02:26 |
|
kotten |
Well.. They seem to get some punches now from the federation :) |
02:27 |
|
sfisque |
federation magic trumps all |
02:27 |
|
sfisque |
lesson one of every star trek series |
02:30 |
|
kotten |
It sure does... we can comfort ourself with that atleast |
02:31 |
|
kotten |
your favourite movie or serie of Star trek? |
02:32 |
|
sfisque |
i liked them all for different reasons. i will say, though, that i liked DS9 up to and excluding the deus ex machina ending… that was "disappointing" to say the least |
02:36 |
|
kotten |
I havnt watched it that much myself. DS9 is that the one with picard? When i was a kid i always watched the one with the male-ish female captain, called ST voyager? But for movies i really like the one with picard and the borgs from the 90s |
02:37 |
|
sfisque |
ds9 had cisco (who teaches acting at my uni :-) |
02:37 |
|
sfisque |
yah first contact was one of the better one's by far |
02:38 |
|
sfisque |
i feel insurrection was probably the weakest of the whole movie collection |
02:38 |
|
kotten |
yeah thats the one!! |
02:39 |
|
kotten |
I always call it "attack of the borg"(swedish tranlation called it something like that) so i always have a hard time finding it :) |
02:39 |
|
kotten |
dont think i have seen that one |
02:40 |
|
sfisque |
insurrection is the one where they try to relocate these people off their planet so they can mine it, and it becomes apparent that its being done "for the wrong reasons" |
02:41 |
|
kotten |
does the ST movies work like windows? One bad, one good, one bad, one good..? =) |
02:41 |
|
kotten |
well never especially good =\ i guess they want to appeal to a broader audiance perhaps |
02:41 |
|
kotten |
like with the new movies, of whom I atleast appreciated the one before the newest. |
02:42 |
|
kotten |
btw have you seen the fan project about refilming ST old-school? |
02:42 |
|
kotten |
a kickstarter thing |
02:42 |
|
kotten |
star trek continues webseries |
02:43 |
|
sfisque |
the general concensus is that the even numbered ones are good the odd ones are bad, but personally i like all of them, though some are better than others |
02:45 |
|
kotten |
where are you from? |
03:00 |
|
|
cem_ joined ##javaee |
03:00 |
|
cem_ |
osan |
03:01 |
|
kotten |
osan? |
03:01 |
|
sfisque |
kotten : us citizen living in us |
03:02 |
|
cem_ |
translation respected sir in japanese my tongue correct ? |
03:03 |
|
kotten |
sfisque: i guess the clock isn't 04:03 there |
03:03 |
|
kotten |
cek |
03:03 |
|
kotten |
cem_: are you talking to me? I am not japanese, I am swedish and kotten = pinecone |
03:03 |
|
kotten |
in swedish |
03:04 |
|
sfisque |
negative kotten, west coast time (pacific daylight time, atm) 20:04 |
03:05 |
|
kotten |
sfisque: aaa.. well it is past 04 in the middle of the soon morning here |
03:05 |
|
kotten |
=) |
03:06 |
|
sfisque |
aye, that would put you around the same TZ as london, no? |
03:06 |
|
kotten |
yup |
03:06 |
|
kotten |
GTM +1 so almost |
03:06 |
|
sfisque |
i had a british chap in my gaming guild many years ago. he'd usually be logging out when most of us were logging in |
03:07 |
|
sfisque |
aye |
03:07 |
|
kotten |
sfisque: I see, what did you play? |
03:08 |
|
cem_ |
translation >> its taking 40 min to copy of 2 GB file |
03:08 |
|
sfisque |
back then, everquest. i ran a guild for a few years (casual, light raiding) |
03:08 |
|
kotten |
I see, you didn't jump on the wow wave? Had alot of friends losing their lives more or less to that game |
03:09 |
|
cem_ |
reduce time how ? |
03:09 |
|
kotten |
one gamed away his job, had to sell his house, left by his wife and kids |
03:09 |
|
sfisque |
wife and i played wow until just before burning crusade came out. the guild we joined imploded and we just decided to cancel our accounts |
03:10 |
|
kotten |
cem_: what and how are you copying the file? To a usb? over the net? What protocols? |
03:10 |
|
sfisque |
the key we found with online gaming was to prioritize. some nights we'd miss a raid or such because it was date night, and that was fine by us |
03:11 |
|
kotten |
But the other guild members didnt appreciate it? |
03:11 |
|
cem_ |
to usb |
03:12 |
|
kotten |
cem_: what usb model? |
03:12 |
|
kotten |
cem_: some usb models are crazy slow like the cruzer blade f.e |
03:13 |
|
kotten |
cem_: are you using java to copy the code or are just throwing the question? Are you transfering one file at a time? What OS do you run? |
03:13 |
|
kotten |
cem_: I mesn java to copy |
03:13 |
|
kotten |
cem_: I mesn java to copy |
03:14 |
|
kotten |
cem_: aaa.. you and me get what i am trying to say.. my fingers dont |
03:14 |
|
cem_ |
コピーするI MESNジャワ ? |
03:14 |
|
sfisque |
are you using a BufferedInputStream and BufferedOutputStream? otherwise you're probably slamming both drives with 1byte fget and fput |
03:14 |
|
cem_ |
yes sfisque using |
03:15 |
|
sfisque |
discovered taht meaty business running a java program inside truss one time |
03:15 |
|
sfisque |
how big are you "windowing" the stream i/o? you might not be saturating the drives enough and spending alot of tiem context switching |
03:16 |
|
sfisque |
4k? 10k? 64k? 1m? |
03:17 |
|
sfisque |
are you doing "read()" or are you using the read() and write() methods that pass in a byte[]? |
03:17 |
|
|
kobain joined ##javaee |
03:17 |
|
cem_ |
using os puppylinux |
03:18 |
|
cem_ |
i use byte[] of 2K |
03:22 |
|
sfisque |
try using bigger windows, like 8k or 16k or 32k and see if that improves the performance |
03:22 |
|
sfisque |
2k for 2gb file is pretty small chunks |
03:22 |
|
sfisque |
most modern drive controllers have 4-32mb on board buffers |
03:23 |
|
sfisque |
so you can easily do chunks are that large fractions of 1mb |
03:24 |
|
kotten |
dont know if this help but check wikipedia on puppy linux "puppy linux also features a sophisticated write-caching system to extend the life of USB flash drives that puppy linux runs from" |
03:25 |
|
kotten |
Could well be a bug or that there is some special case with puppy linux and usbs in general that could be worth looking into |
03:25 |
|
kotten |
that line alone has two references... |
03:26 |
|
sfisque |
oh, yeah, that might affect it too |
03:26 |
|
kotten |
check.. puppylinux.com/development/howpuppylinuxwroks.htm |
03:26 |
|
kotten |
I am looking it up on the other comp so might be wrong spelled |
03:26 |
|
kotten |
year ...linuxworks.htm |
03:26 |
|
kotten |
year= yeah |
03:26 |
|
kotten |
and it is really really late |
03:27 |
|
kotten |
I guess i'll try to get some sleep |
03:27 |
|
sfisque |
g'nite kotten |
03:28 |
|
kotten |
sfisque: good night sfisque thanks for the help and the conversation |
03:28 |
|
sfisque |
npnp.. always fun! code strong! |
03:30 |
|
cem_ |
translation << if i increase to 32mb getting outofmem |
03:34 |
|
cem_ |
i increased to 12K いい thanks |
03:34 |
|
cem_ |
sfisque |
03:37 |
|
cem_ |
copying.......... |
03:41 |
|
sfisque |
kk |
04:18 |
|
|
kobain joined ##javaee |
04:18 |
|
cem_ |
i made 5 test it took just 8 min thanks sfisque |
04:18 |
|
|
Guest27688 joined ##javaee |
04:18 |
|
sfisque |
gratz :-) |
04:19 |
|
|
kobain_ joined ##javaee |
04:20 |
|
|
kobain_ joined ##javaee |
04:20 |
|
|
Guest34552 joined ##javaee |
06:54 |
|
|
cheater_3 joined ##javaee |
07:27 |
|
|
AlexCzar joined ##javaee |
08:03 |
|
|
Quest joined ##javaee |
11:17 |
|
|
cem_ joined ##javaee |
11:18 |
|
|
MegaMatt joined ##javaee |
11:18 |
|
cem_ |
osan |
11:27 |
|
pdurbin |
cem_: osan? |
11:28 |
|
cem_ |
translation >> respected sir or madam english correct ? |
11:40 |
|
pdurbin |
cem_: seems a little formal :) |
11:41 |
|
* pdurbin |
puts on his best t-shirt for work |
11:52 |
|
|
whartung_ joined ##javaee |
11:57 |
|
cem_ |
anyone use linux ? |
12:00 |
|
Fubar^ |
sure |
12:01 |
|
* cem_ |
#ubuntu |
12:02 |
|
* cem_ |
using puppylinux |
12:03 |
|
cem_ |
how to get temperature of CPU ? |
12:03 |
|
Fubar^ |
you could use lm_sensors for example |
12:04 |
|
cem_ |
i dont have that |
12:04 |
|
Fubar^ |
install it then |
12:04 |
|
cem_ |
translator > any rpm package osan? |
12:05 |
|
Fubar^ |
i don't know what that means |
12:05 |
|
Fubar^ |
I haven't used ubuntu in a long time but i guess you could do something like "apt-get install lm_sensors" |
12:14 |
|
cem_ |
puppylinux is not debian |
12:14 |
|
cem_ |
translator |
12:17 |
|
Fubar^ |
well, use whatever package manager you have |
12:23 |
|
pdurbin |
cem_: try this: yum search lm_sensors |
12:44 |
|
cem_ |
installed it thanks all |
12:51 |
|
|
tommmied joined ##javaee |
13:20 |
|
|
kotten joined ##javaee |
13:46 |
|
acuzio |
is Quest around ? |
13:46 |
|
acuzio |
clearly not |
13:55 |
|
|
Naros joined ##javaee |
13:57 |
|
pdurbin |
has anyone used https://pagekite.net to put their local dev environment (glassfish or whatever) on a public ip address? I'm considering this because SAML Identity Providers I'm working with need to reach the SAML Service Provider I'm coding up on a public IP address |
14:10 |
|
sess |
their whole service sounds like just a dynamic dns? |
14:13 |
|
pdurbin |
well, the idea is that glassfish on port 8080 on localhost for me (my laptop) gets served up on port 80 on a public ip address. that way the hosts I want to test with can reach the code I just deployed to my laptop |
14:20 |
|
|
neuro_sys joined ##javaee |
14:46 |
|
Naros |
We've used Apache + AJP to do just that pdurbin. |
14:46 |
|
Naros |
internet -> apache -> ajp protocol over to ajp port on app server |
14:47 |
|
sess |
pdurbin: what stops them from accessing your site without pagekite? |
14:47 |
|
sess |
you can just switch to using port 80 |
14:47 |
|
sess |
and using your ip |
14:47 |
|
sess |
if your ip is not public, pagekite wont be able to see it either.. |
14:47 |
|
sess |
perhaps if it installs some kind of client on your development machine that tunnels traffic |
14:49 |
|
pdurbin |
Naros: I started playing with AJP for the first time last week. To host an app running on tomcat (port 8080, I think) with apache (port 80). worked fine. oh wait. port 8009, I guess: ProxyPass /hello ajp://localhost:8009/hello (in the apache config) |
14:50 |
|
Naros |
yah AJP uses I think 8009 by default but can be anything |
14:50 |
|
Naros |
since its a binary protocol iirc. |
14:51 |
|
pdurbin |
sure. well, http://pdurbin.pagekite.me seems to be working. for now just with python's SimpleHTTPServer on port 8000 |
14:52 |
|
Naros |
:) |
14:52 |
|
pdurbin |
now to try it with glassfish |
14:53 |
|
pdurbin |
sess: yes, you run the pagekit client on your laptop |
14:53 |
|
pdurbin |
pagekite* |
14:54 |
|
Naros |
Yeah sounds like the dynadns clients from back in the day when you ~could~ run servers on residental internet accounts until the providers got smart. :P |
14:57 |
|
pdurbin |
Naros: your AJP sounds interesting too |
14:58 |
|
Naros |
We primarily use AJP to allow Apache to do load balancing between multiple tomcat servers in a cluster. |
14:59 |
|
sess |
pdurbin: oh, fair enough then |
14:59 |
|
pdurbin |
Naros: but you use it for my dev environment scenario too? |
14:59 |
|
sess |
that said, id never put my development machine public |
14:59 |
|
pdurbin |
sess: meh. our code is open source anyway :) |
14:59 |
|
Naros |
I wouldn't be able to point it to your box, no. |
14:59 |
|
sess |
was more thinking of security holes |
15:00 |
|
Naros |
Our DMZ is locked down to allow AJP ports inbound only to tomcat servers and not back out through the firewall. |
15:00 |
|
Naros |
There'd be questions raised if I tried to do that :P |
15:00 |
|
pdurbin |
heh |
15:00 |
|
pdurbin |
Naros: but in theory, I could do the same thing with AJP? pagekite seems super easy |
15:01 |
|
Naros |
Yah if you can get apache on some public ip on port 80, yep |
15:01 |
|
Naros |
but then at that point, why not just setup glassfish or w/e on port 80 |
15:01 |
|
Naros |
I use AJP+Apache mainly because having server in DMZ and ahving app server behind a 2nd firewall |
15:01 |
|
sfisque |
because an ejb container exposes more endpoints than just port 80 |
15:01 |
|
Naros |
sfisque: very true. |
15:01 |
|
|
tommmied joined ##javaee |
15:02 |
|
pdurbin |
nice, https://pdurbin.pagekite.me is serving up glassfish from my laptop now |
15:02 |
|
sfisque |
even my personal stuff is proxied through httpd because i don't want to unnecessarily expose any services that could be hit via spoofing and other exploits |
15:02 |
|
Naros |
I haven't tried getting the AJP connector to work with GF before, so that might be a feat, idk :P |
15:02 |
|
Naros |
nice |
15:03 |
|
Naros |
bah GF 3.1.2 :/ |
15:03 |
|
Naros |
GF4 FTW! |
15:03 |
|
sfisque |
container shouldnt matter. as long as you the ajp knows the remote port to send to, it's container transparent |
15:03 |
|
sfisque |
as far as the container is concerned, ajp is just another client |
15:04 |
|
pdurbin |
Naros: GF4 someday :) |
15:04 |
|
Naros |
Understood, just know i had some configs I had to enable in Tomcat to get it to work and since I haven't tried it under GF and I'm a GF noob, *shrugs* |
15:04 |
|
Naros |
Wasn't sure how easy or complex such a setup might be but heard it was doable. |
15:07 |
|
sfisque |
as far as i remember, i didnt have to do anything on the jboss side, it was all httpd configuration. the only thing i can see being problematic is if you're running virtualhosts, then you might have to do some leg work on the container |
15:08 |
|
Naros |
that would make sense. |
15:09 |
|
Naros |
oh sfisque, quick question for yas. |
15:09 |
|
Naros |
or anyone for that matter, but anywho |
15:09 |
|
sfisque |
ok, i'm about to bounce to take the kids to school, but i'll see what i can muster in 60 seconds :-) |
15:10 |
|
Naros |
So our webapp needs to enqueue requests to run on a background application and once done, it writes the results to the database. I want to make sure this background app is cluster-aware in the event that we need to scale it due to load. |
15:10 |
|
Naros |
Any suggestions on what to base this queue mechanism around? |
15:11 |
|
Naros |
background app will mainly run period scheduled tasks and any large resultset export requests to avoid running it inside the webapp container and consuming resources on that tier. |
15:11 |
|
sfisque |
webapp container -> some messaging queue (gf bundles one for free) -> MDBs monitoring the queue (no need for background app) -> JPA -> sql repo |
15:12 |
|
sfisque |
or replace MDB with SLSB with @Asynch methods |
15:12 |
|
sfisque |
pick your flavor :-) |
15:12 |
|
sfisque |
and i'm out. code strong! |
15:12 |
|
Naros |
Aye but that's all EJB stuff which would imply being on GF or JBoss :P |
15:12 |
|
Naros |
er JavaEE rather than EJB but you know |
15:13 |
|
Naros |
hm |
15:13 |
|
|
jieryn joined ##javaee |
15:13 |
|
|
jieryn joined ##javaee |
15:28 |
|
sfisque |
oh you can always roll your own, but why when you have a stack that will handle the heavy lifting for you? |
15:28 |
|
sfisque |
btw, i should have said @Scheduled, not @Asynch |
15:28 |
|
sfisque |
otherwise you have to code something that looks like the above, but instead of concentrating on BL, you have to write the whole infrastructure too |
15:29 |
|
Naros |
nod |
15:29 |
|
sfisque |
Threaded Object -> MQ -> Threaded Object sniffing MQ -> JDBC -> SQL repo |
15:29 |
|
Naros |
Would just need to get the tomcat webapp to be able to produce on the jms queue and weould be set. |
15:30 |
|
Naros |
Run the other stuff in the JavaEE container until I can get the webapp ported. |
15:30 |
|
sfisque |
ok. then you can "fake ejb" and use a spring bean to tie between the servlet layer and remote MQ, OR you can roll your own and use apache commons pooling and create a processing pool that handles the push to MQ |
15:31 |
|
Naros |
yep |
15:31 |
|
sfisque |
i did that years ago when i worked at an EE adverse company. basically created poor mans EE using apache pooling and digester |
15:31 |
|
Naros |
but since that "export stuff" can consume some significant resources, probably ideal to have that on it's own JavaEE container separate from the web facing still tho, yah? |
15:32 |
|
sfisque |
export where, export TO the MQ or export From the MQ? |
15:32 |
|
Naros |
sorry, no the get resultset, iterate and write to output file type exporting. |
15:33 |
|
Naros |
When it was embedded in the tomcat webapp, having 5 of those running simultaneously was a strain on the process. |
15:33 |
|
sfisque |
oh. i dont know if tomcat exposes worker threads, but if it does use those. otherwise you need to figure out some safe way to do asynch in the servlet container |
15:34 |
|
sfisque |
kk, going afk for reals this time. ttyas |
15:34 |
|
Naros |
nod, I had an executor that was started upon context startup which created some threads and just dispatched to those as tasks were queued to the executor. |
15:34 |
|
Naros |
bye! |
15:59 |
|
|
Quest joined ##javaee |
16:00 |
|
Quest |
I was not expecting lazy initialization error and I did all the calls in transactional boundries of service methods. http://pastebin.ca/2472200 any ideas? |
16:01 |
|
Naros |
do box.getTaskList().size(); |
16:01 |
|
Naros |
I dont believe box.getTaskList() will actually initialize the collection iirc. |
16:01 |
|
whartung |
no that's a lazy list |
16:02 |
|
Quest |
A BOARD has BOXES, A BOX may have further CHILD BOXES, a BOX may havve Further CHILDTASKs. The said method works for the BOXes list of board, but dont go futher to TASKLIST |
16:02 |
|
Quest |
whartung, am? |
16:02 |
|
Quest |
Naros, it wont init? |
16:02 |
|
whartung |
? |
16:03 |
|
Naros |
The reason it works for the childBoxList and not the task list is beacuse you actually iterate the box list in the second method |
16:03 |
|
Quest |
whartung, its a lazy initializatioin? |
16:03 |
|
Naros |
that triggers a load |
16:03 |
|
whartung |
the original list is basically a shell without the data being loaded |
16:03 |
|
whartung |
it won't load until it's actually necessary |
16:03 |
|
Quest |
Naros, the second method is also @Transactional |
16:03 |
|
Naros |
Quest: right but within the same class, @Transactional only applies to the first called method |
16:03 |
|
Quest |
whartung, but I iterated. and getTasks() |
16:04 |
|
Quest |
whartung, but I iterated. and getTasksList() |
16:04 |
|
whartung |
I didn't look at the code |
16:04 |
|
whartung |
simply doing "getListThing()" will simply return the proxy |
16:04 |
|
Quest |
Naros, hmm. even then . the first method was itself @Transactional and any thing done INSIDE that method should be in boundries |
16:04 |
|
Naros |
Right but as whartung just said, just calling getMyList() only returns the proxy, no loading occurs. |
16:05 |
|
Naros |
If you do getMyList().size(), that forces loading |
16:05 |
|
Naros |
or iterate the list will do the same |
16:05 |
|
Naros |
or if you're using jpa, fetch then with subselects |
16:06 |
|
Naros |
This is where ORM frameworks are nice because you tell the ORM what data you want it to populate, hand it off and gives you back the board with all the data you need :P |
16:07 |
|
Naros |
a hibernate-specific trick is to use Hibernate.initialize(myEntity.getMyList()); |
16:07 |
|
Naros |
it forces the proxy to load the collection as if you iterated it |
16:08 |
|
Naros |
You're using JDBC right ? |
16:08 |
|
Naros |
or are you actually using JPA? |
16:10 |
|
whartung |
should be using the LAZY and EAGER annotations as appropriate |
16:10 |
|
sess |
the annotations can rarely be used, as few collections are always wanted |
16:11 |
|
Naros |
OneToMany by default is LAZY |
16:11 |
|
sess |
nothing wrong with specifying per query |
16:11 |
|
Naros |
right |
16:12 |
|
Naros |
My rule of thumb is that the DAO method should return an object with all its data before any business logic does anything with it. |
16:12 |
|
sess |
that will create performance issues most likely |
16:12 |
|
Naros |
forces those DAO methods to be specific use cases and avoids this lazily load crap |
16:12 |
|
Naros |
sess: Actually quite the opposite. |
16:13 |
|
Naros |
It forces you to create queries for that specific case only. |
16:13 |
|
sess |
having all collections eager is not quite the opposite |
16:13 |
|
|
Quest joined ##javaee |
16:13 |
|
Naros |
If you need data for a different screen with different requirements, create a new DAO method |
16:13 |
|
whartung |
really depends on how deep the hierarchies are as fell. |
16:13 |
|
whartung |
paly9ing for JOINFETCH helps a lot too |
16:13 |
|
whartung |
but it can only go so far. |
16:13 |
|
sess |
oh i missunderstood you Naros |
16:13 |
|
sess |
you mean to load the data wanted |
16:13 |
|
sess |
not ALL data |
16:13 |
|
Naros |
Precisely. |
16:14 |
|
Naros |
You end up with several DAO methods that have similar characteristics, then you refactor those |
16:14 |
|
sess |
that said, i dont see any bad part of lazy loading in business |
16:14 |
|
sess |
layer |
16:14 |
|
Naros |
Generally, there isn't |
16:14 |
|
sess |
only issue is uninitialized collections bubbling up to controller layer |
16:14 |
|
Naros |
Yep, but sometimes there are more efficient ways to get the data you want that a custom DAO method handles pretty well. |
16:15 |
|
Naros |
rather than using the lazy initialize approach |
16:15 |
|
sess |
it doesnt matter much if you load the data in the query via join fetch, or initialize them later |
16:16 |
|
sess |
as long as you use the proper annotations for lazy loading method |
16:16 |
|
Naros |
In quest's unique case, if he reverts his problem the lazy loading goes away completely :P |
16:16 |
|
Naros |
query tasks with a board id |
16:16 |
|
whartung |
well it matter in overall query performance. If you can join fetch, it's much faster than lazy loading the collection |
16:17 |
|
Naros |
This way the child's @ManyToOne annotation eagerly loads the parents. |
16:17 |
|
sess |
whartung: not really |
16:18 |
|
Naros |
It can go either way, heavily depending upon the resultset in question. |
16:18 |
|
Naros |
but generally 1 database call to get all the data joined is faster. |
16:18 |
|
sess |
the resulting SQL is identical im pretty sure |
16:18 |
|
whartung |
yea, really. You want to see it exacerbated? Try it over a connection with any latency on it. The difference between a single query and half dozen queries is night and day. |
16:18 |
|
Naros |
Aye. |
16:18 |
|
sess |
later initialization doesnt mean more queries really |
16:19 |
|
sess |
depending on how it is annotated |
16:19 |
|
whartung |
where is it going to get the data from? |
16:19 |
|
Naros |
We lazily loaded our roles in the service tier during login and over a VPN connection from my laptop back to the DB server at work was terribly slow. |
16:19 |
|
sess |
a single jpa query can cause multiple sql queries |
16:19 |
|
Naros |
Changed it to Eager fetch and got the data in reverse and login took less than 500ms. |
16:20 |
|
Naros |
sess: that all depends on how you approach your queries. |
16:20 |
|
sess |
you are probably not using @Fetch then |
16:20 |
|
Naros |
as I said, its sometimes easier to start the query at the bottom and let the joined parents bubble up in a single query. |
16:20 |
|
sess |
i seldom get more than a few queries when using hibernate.initialize |
16:21 |
|
Naros |
Sure, using the proper batchsize, etc |
16:21 |
|
Naros |
But that depends on the query & data model. |
16:21 |
|
Naros |
er requirements & data model I mean |
16:21 |
|
sess |
@Fetch even changes the way the querying is done i think |
16:21 |
|
Naros |
In quest's case he wants grand parents, parents, and children |
16:22 |
|
whartung |
yea, deep hierarchies are a problem |
16:22 |
|
sess |
well with a node based design, you cant even do it in a single query |
16:22 |
|
Naros |
Right and I've found if you can query the children, getting the parents & grand parents is easy. |
16:24 |
|
sess |
ive written oracle queries joining nodes with parents |
16:24 |
|
sess |
most horrible thing ive ever seen |
16:24 |
|
Naros |
hehe, im just saying that if you use the @ManyToOne annotation to your benefit, you can get the same data if you can approach it from the reverse end. |
16:32 |
|
|
oO0Oo joined ##javaee |
16:34 |
|
pdurbin |
woo hoo! https://pagekite.net/support/free-for-foss/ |
16:36 |
|
whartung |
what is pagekite? |
16:38 |
|
pdurbin |
whartung: I'm using it to serve up the glassfish from my laptop |
16:39 |
|
whartung |
what does it do? |
16:39 |
|
pdurbin |
whartung: the IdPs I'm testing with need to access SP on a public ip address |
16:39 |
|
pdurbin |
with pagekite, they can: https://pdurbin.pagekite.me/dvn/saml/metadata |
16:39 |
|
whartung |
and what does that have to do with page kit? |
16:43 |
|
pdurbin |
whartung: https://pagekite.net/support/faq/#howdoesitwork |
16:43 |
|
whartung |
how about a "what does it do" |
16:43 |
|
pdurbin |
I tell pagekite I want to serve up port 8080 (glassfish) from my laptop |
16:43 |
|
whartung |
what. does. it. do |
16:44 |
|
pdurbin |
and it puts it at https://pdurbin.pagekite.me/ |
16:44 |
|
whartung |
so it's a proxy? |
16:44 |
|
whartung |
how is it different from a normal dynamic DNS provider? |
16:44 |
|
whartung |
or are they standing up SSH tunnels? |
16:45 |
|
pdurbin |
yeah. tunnels |
16:45 |
|
whartung |
I've use dynamic dns providers in the past, it worked out ok. |
16:46 |
|
whartung |
and rerouted traffic at the router |
16:47 |
|
pdurbin |
whartung: to serve up glassfish from your laptop? |
16:47 |
|
whartung |
yes |
16:47 |
|
whartung |
well, my desktop |
16:47 |
|
pdurbin |
ok. I don't have control over our routers |
16:48 |
|
whartung |
from my ouse |
16:48 |
|
whartung |
house |
16:49 |
|
pdurbin |
this seems like the best way for me to iterate on my SP code and get it on a public IP so the IdP can reach it |
16:50 |
|
whartung |
yea |
16:50 |
|
whartung |
you should just work with your netops guys to have it done right |
16:51 |
|
pdurbin |
whartung: yeah? this is so easy. done already. and free for open source projects |
16:54 |
|
|
Guest82011 joined ##javaee |
17:13 |
|
|
jieryn joined ##javaee |
17:25 |
|
Quest |
Naros, whartung appologies for getting disconnected in the middle. had fiber problems. I saw the logs. and will do .size() this time. |
17:28 |
|
sfisque |
be careful with that though. if the collection is big enough with large elements, calling .size() or other collection method can be a huge perf hit. weigh whether you want/need to fetch them all at once or if you can swallow an iterated "Select where PK = x.n" |
17:29 |
|
Quest |
sfisque, i definately need to fetch ALL of them |
17:30 |
|
Quest |
just replaced box.getTaskList() with box.getTaskList().size(); |
17:31 |
|
sfisque |
right. the question is, is the tastList going to generally be anemic (let's say, less than 50 objects) or can it potentially be holding 100's or 1000's of objects? |
17:32 |
|
sfisque |
because a lazy fetch of a collection is going to give you the 1+n select issue, unless you either annotate the join to do a bulk fetch (proprietary per impl) or you craft your query to prefetch them in cases where you want them front loaded |
17:35 |
|
Quest |
sfisque, not more than 100s but may be 1000s |
17:35 |
|
Quest |
the front is loaded in one go |
17:35 |
|
sfisque |
ok. then i would recommend revisiting this method after you get it working mechanically |
17:36 |
|
sfisque |
and look into the two aspects i mentioned above |
17:36 |
|
sfisque |
both have advantages and disadvantages, so you have to weigh accordingly |
17:36 |
|
Naros |
We generally use a grid like approach in the web tier for many children associated to a parent concept where we page in a batch of 50 as the user scrolls or pages the content. |
17:37 |
|
sfisque |
aye, paging is another alternative |
17:37 |
|
Naros |
can easily map that to the JPA query |
17:37 |
|
Naros |
setFirstResult().setMaxResult() |
17:38 |
|
sfisque |
filtering is another, where you never show the whole set, but force the user to elicit a "cull" via some wizardy interface |
17:38 |
|
Quest |
sfisque, hm |
17:38 |
|
Naros |
Yep |
17:38 |
|
Quest |
Naros, hm.. |
17:38 |
|
Quest |
paginations |
17:38 |
|
Naros |
Quest: if you're going for a web 2.0 solution, you might want to look into something like jqGrid :P |
17:38 |
|
Naros |
or even DataTables |
17:39 |
|
Naros |
User selects a board, you populate grid1 with your child info and once they select the child, you populate grid2 with the tasks. |
17:40 |
|
Naros |
thats just one of many possibilities of how to design the UI |
17:50 |
|
Quest |
I have @OneToMany for BOX to TASK relationship and I see the BOX ids in the TASK table too as the parents of TASKs. isnt this snap strange then? http://oi43.tinypic.com/1oj4.jpg |
17:50 |
|
Quest |
Naros, hm |
17:51 |
|
|
kobain joined ##javaee |
17:51 |
|
Quest |
whartung, sfisque Naros sess the .size() solved the lazy init problem though but this was strange though ^ |
17:51 |
|
Naros |
Can you paste your @OneToMany and @ManyToOne mappings? |
17:52 |
|
Naros |
from Box and Task entities |
17:52 |
|
Naros |
sounds to me like you didn't define one side as the owner and the other as a participant. |
17:52 |
|
Naros |
I would expect the parent box id in the task table tho |
17:52 |
|
Quest |
sure |
17:53 |
|
sess |
yup, looks like wrong mappings |
17:53 |
|
Naros |
i wouldn't expect anything task related in the box table |
17:55 |
|
Quest |
http://pastebin.ca/2472224 |
17:56 |
|
sess |
the plural names of the classes still makes the code almost unreadable lol |
17:59 |
|
sess |
Quest: try running the actual sql in a query |
17:59 |
|
sess |
see what you get |
17:59 |
|
sess |
also, for the love of god use generics in your code |
18:02 |
|
|
Quest joined ##javaee |
18:02 |
|
Quest |
disconnected again. last message recieved: <Naros> i wouldn't expect anything task related in the box table |
18:02 |
|
Quest |
<Quest> http://pastebin.ca/2472224 |
18:03 |
|
sess |
[18:57] < sess> | the plural names of the classes still makes the code almost unreadable lol | |
18:03 |
|
sess |
[18:59] < sess> | Quest: try running the actual sql in a query | |
18:03 |
|
sess |
[18:59] < sess> | see what you get | |
18:03 |
|
sess |
[18:59] < sess> | also, for the love of god use generics in your code |
18:03 |
|
Quest |
ya. had to refactor the plurals |
18:04 |
|
Quest |
generics. iam weak at that. |
18:04 |
|
Quest |
actual query? am... on pgAdmin ? |
18:07 |
|
Quest |
sess, well the table TASKS has the parent id. so no need to be more sure.. |
18:07 |
|
sess |
you should really learn the java basics before moving on to JPA |
18:08 |
|
sess |
as for the actual query, i mean copypasting the logged SQL and trying it out in the SQL client of your choice |
18:08 |
|
sess |
and see if you get data for the children |
18:08 |
|
sess |
if not, then you can probably figure out whats wrong from the query |
18:08 |
|
Quest |
hm |
18:11 |
|
Quest |
i ran this, but it showed me just columns and no data. select childboxli0_.BoxId as BoxId1_5_5_, childboxli0_.childBoxId as childBox2_9_5_, boxes1_.id as id1_5_0_, boxes1_.company_id as company6_5_0_, boxes1_.description as descript2_5_0_, boxes1_.isFirstLevelBox as isFirstL3_5_0_, boxes1_.parentBoard_id as parentBo7_5_0_, boxes1_.parentBox_id as parentBo8_5_0_, boxes1_.title as title4_5_0_, boxes1_.type as type5_5_0_, companies2_.id as id1_10_ |
18:11 |
|
Quest |
1_, companies2_.address1 as address2_10_1_, companies2_.address2 as address3_10_1_, companies2_.address3 as address4_10_1_, companies2_.description as descript5_10_1_, companies2_.name as name6_10_1_, companies2_.phone1 as phone7_10_1_, companies2_.phone2 as phone8_10_1_, companies2_.phone3 as phone9_10_1_, boards3_.id as id1_1_2_, boards3_.company_id as company4_1_2_, boards3_.description as descript2_1_2_, boards3_.title as title3_1_2_, compa |
18:11 |
|
Quest |
nies4_.id as id1_10_3_, companies4_.address1 as address2_10_3_, companies4_.address2 as address3_10_3_, companies4_.address3 as address4_10_3_, companies4_.description as descript5_10_3_, companies4_.name as name6_10_3_, companies4_.phone1 as phone7_10_3_, companies4_.phone2 as phone8_10_3_, companies4_.phone3 as phone9_10_3_, boxes5_.id as id1_5_4_, boxes5_.company_id as company6_5_4_, boxes5_.description as descript2_5_4_, boxes5_.isFirstLeve |
18:11 |
|
Quest |
lBox as isFirstL3_5_4_, boxes5_.parentBoard_id as parentBo7_5_4_, boxes5_.parentBox_id as parentBo8_5_4_, boxes5_.title as title4_5_4_, boxes5_.type as type5_5_4_ from Boxes_childboxes childboxli0_ inner join Boxes boxes1_ on childboxli0_.childBoxId=boxes1_.id left outer join Companies companies2_ on boxes1_.company_id=companies2_.id left outer join Boards boards3_ on boxes1_.parentBoard_id=boards3_.id left outer join Companies companies4_ on b |
18:11 |
|
Quest |
oards3_.company_id=companies4_.id left outer join Boxes boxes5_ on boxes1_.parentBox_id=boxes5_.id where childboxli0_.BoxId=200 |
18:11 |
|
Quest |
oh sorry, didnt noticed the length |
18:13 |
|
Naros |
woah come back to a screen of SQL ;o |
18:13 |
|
Naros |
so quest the reaso nwhy you have a parent box id in both tables is because you have box refer to itself which makes sense. |
18:15 |
|
Naros |
Personally I wold have mapped Collection<Tasks> as follows: |
18:15 |
|
sess |
Quest: hibernate aliases all the columns |
18:15 |
|
sess |
so its reaaally long |
18:15 |
|
Naros |
@OneToMany(cascade=CascadeType.REMOVE,mappedBy="parentBox") |
18:15 |
|
sess |
if you look, there is a FROM there somewhere |
18:15 |
|
sess |
and a few joins |
18:16 |
|
Naros |
If not and you decide to add two Boxes properties to Task at some point, you'll have problems. |
18:17 |
|
Quest |
"add two Boxes properties to Task at some point,"? |
18:18 |
|
Naros |
Right now you're relying on the ORM to say oh I got a property ABC of type Boxes, that should be what gets mapped to this other entity's mapping. |
18:18 |
|
Naros |
Instead of telling the ORM explicitly what is being mapped |
18:18 |
|
Naros |
mappedBy="parentBox" explicitly defines the property relationship |
18:19 |
|
Naros |
if you add private Boxes someOtherBox; property to Task I bet Hibernate may choke or give you undefined results. |
18:19 |
|
Naros |
or worse, works but does bad stuff to the data :/ |
18:20 |
|
Quest |
hm ok. but even if i dont do mappedBy="parentBox" on TASK class . it should work still. shouldnt it |
18:20 |
|
Quest |
i mean it should.. |
18:21 |
|
sess |
mappedBy is probably mandatory |
18:21 |
|
Naros |
Hibernate probably makes it work only because you have 1 property on TASK that is of class type Boxes. |
18:21 |
|
sess |
perhaps not if the naming of the property is exactly correct |
18:22 |
|
Naros |
But frankly, your mappings need to be more explicitly imo |
18:22 |
|
Naros |
*explicit |
18:22 |
|
sess |
typing out all column names would make it more stable and get better namings |
18:23 |
|
Naros |
We do that here, we don't allow the ORM to create them |
18:23 |
|
Naros |
PARENT_BOX_ID and such |
18:23 |
|
Naros |
None of this camel case mess |
18:24 |
|
Naros |
But that's entirely a preference |
18:24 |
|
sess |
i think creating the tables with hibernate is a very bad practice |
18:24 |
|
sess |
especially when learning |
18:24 |
|
Naros |
No doubt. |
18:25 |
|
sess |
because rather than getting a simple error |
18:25 |
|
sess |
you get weird relations |
18:25 |
|
Quest |
hm |
18:25 |
|
sess |
not to mention, really weird tables sometimes |
18:25 |
|
sess |
one project i have has a table with a foreign key to another table |
18:25 |
|
sess |
the second table is called "double_val" |
18:25 |
|
sess |
and has only a generated PK and a single value |
18:25 |
|
sess |
lol |
18:26 |
|
Naros |
The only thing we allow hibernate to do is validate the schema during startup so that if we have a mapping and the database schema won't support it we know right away. But beyond that, database manipulations are done via scripts which are maintained with the release. |
18:27 |
|
Quest |
just did @OneToMany(cascade=CascadeType.REMOVE,mappedBy="parentBox") |
18:27 |
|
Quest |
private Collection<Tasks> taskList = new ArrayList<Tasks>(); |
18:27 |
|
Quest |
in Boxes class |
18:27 |
|
Naros |
yah |
18:28 |
|
Quest |
but that wont change anything in the table. right? the parent id of box id would remain same in TASKS table |
18:28 |
|
Naros |
and validation gets disabled during deployment to production since that technically should be unnecessary |
18:28 |
|
Naros |
That won't change a thing. |
18:28 |
|
Quest |
hm |
18:28 |
|
Quest |
just facilitate hibernate in finding out |
18:28 |
|
Naros |
It just explicitly tells Hibernate what property is the other side of the relationship. |
18:28 |
|
Quest |
I was not in an impression that mappedBy was compulsory |
18:28 |
|
Quest |
I was not in an impression that mappedBy was compulsory though |
18:28 |
|
Quest |
ok |
18:29 |
|
* Quest |
tests |
18:29 |
|
Naros |
It isn't required, but generally is a good idea to use it |
18:29 |
|
Naros |
As I said, some future devloper comes along and adds another Boxes property to Task and now the app go boom |
18:29 |
|
Quest |
hm |
18:29 |
|
* Naros |
knows from his own ignorant experiences. |
18:30 |
|
Quest |
so mapped by is must for all relations? m2m m2o o2m o2o ? |
18:30 |
|
Naros |
No |
18:31 |
|
Naros |
iirc, @OneToOne, @OneToMany, and @ManyToMany |
18:32 |
|
Naros |
@ManyToOne usually is the owning side of the relationship so it would be like your Task. |
18:32 |
|
Naros |
therefore, it has all the join information |
18:33 |
|
Quest |
looks like its working (just the .jsp forEach issues. but I am getting the tasks!!!!) |
18:33 |
|
Naros |
:) |
18:35 |
|
Quest |
hm. works |
18:35 |
|
Quest |
:) thanks |
18:37 |
|
|
sess joined ##javaee |
18:39 |
|
|
sess_ joined ##javaee |
18:43 |
|
|
sess__ joined ##javaee |
18:44 |
|
|
sess joined ##javaee |
18:49 |
|
|
cem_ joined ##javaee |
18:51 |
|
|
sess joined ##javaee |
18:53 |
|
|
sess joined ##javaee |
18:59 |
|
|
AlexCzar joined ##javaee |
19:03 |
|
|
sess_ joined ##javaee |
19:37 |
|
sfisque |
dont worry too much about generics Quest. they're just syntactic sugar and dont actually provide any facility other than type safety on collections and templates |
19:41 |
|
cem_ |
translator > Quest not there |
19:42 |
|
sfisque |
ha, i missed him |
19:43 |
|
sfisque |
well, he'll hopeuflly see it in the clog |
19:43 |
|
cem_ |
certain things works in open office but not in miscrosoft office |
19:44 |
|
sess |
generics are wonderful |
19:44 |
|
cem_ |
translator > certain things works in open office but not in microsoft office |
19:44 |
|
sess |
reduces code, very easy to learn, removes a lot of potential bugs |
19:46 |
|
sfisque |
generics are great, but they can be badly abused. my point was that he should learn the core stuff and generics can be picked up later |
19:46 |
|
sess |
abused how? |
19:47 |
|
sfisque |
we had someone here before i came on board create a whole inheritence chain where controllers were defined XXController<T>, which as you can assume is a very terrible design paradigm, and when you add inheritence chains several deep, it becomes difficult to unravel it |
19:47 |
|
sess |
thats abusing inheritence |
19:47 |
|
sess |
not abusing generics |
19:47 |
|
sfisque |
tying a controller to a single object type makes for a rigid and inflexible design |
19:48 |
|
sfisque |
what if my view requires the controller to managed 4 different object types at the same time |
19:48 |
|
sfisque |
i then have to square-peg / round hole it |
19:49 |
|
sess |
the alternative without generics would be to have XXController with an Object as a field |
19:49 |
|
sfisque |
for things like collections, visitors, etc where you are deep and not having to multi-context, generics make all sorts of sense |
19:49 |
|
sess |
rather than a better design |
19:49 |
|
sfisque |
composition is a valid and in many ways, preferable semantic in the EE world |
19:49 |
|
sess |
it sounds like youre taking horrible design, throw on generics for good measure, than claim that it was generics that ruined it |
19:49 |
|
sfisque |
inheritence can play havoc with SLSBs, especially with @PostConstructs |
19:50 |
|
sfisque |
no, i'm saying generics allowed him to create a terrible inner platform. without generics, it would have been trivial to unravel |
19:50 |
|
sfisque |
it was the oil under his skids |
19:51 |
|
sfisque |
obviously HE created the bad design. i'm saying the abusability of generics greased his progression |
19:51 |
|
sfisque |
not that it was the source of it |
19:51 |
|
sess |
you can just remove the <> and replace references by Object |
19:51 |
|
sess |
that is what it would have been without generics |
19:52 |
|
sess |
i think calling generics the culprit in that sitation is a bit far fetched |
19:52 |
|
sfisque |
not at all. in naive hands, generics can promote base bean and call super anti-patterns |
19:52 |
|
sfisque |
dont get me wrong, generics are wonderful tool, i'm just saying they are not necessarily for newbies |
19:53 |
|
sfisque |
because they are easily abused |
19:53 |
|
sess |
I think all the dangerous parts comes from misuse of inheritence (which i guess can be promoted by the existance of generics) |
19:53 |
|
sfisque |
i feel the same about reflection, and i've LOVED reflection ever since they added it to the jvm |
19:53 |
|
sess |
but lets agree to disagree :) |
19:54 |
|
sfisque |
sure |
19:54 |
|
sfisque |
:-) |
19:54 |
|
cem_ |
Quest dont know java ? |
19:54 |
|
sfisque |
he's learning cem_ |
19:54 |
|
sfisque |
he's well on his way, but with every answerm, 1000 questions :-) |
19:54 |
|
cem_ |
:D |
19:55 |
|
cem_ |
translator > you people are dead |
19:55 |
|
sfisque |
in some parallel dimension, that is very true |
20:00 |
|
cem_ |
translator > generics cant restrict a lot |
20:01 |
|
Naros |
For the life of me i cannot seem to recall how to do this but i have @ManyToOne flagged as lazy and in JPQL, I want to eagerly fetch this association along with a collection of children related to the parent. |
20:02 |
|
Naros |
SELECT DISTINCT e FROM Entity e LEFT JOIN e.child c JOIN FETCH e.collection |
20:02 |
|
Naros |
child never gets loaded tho |
20:03 |
|
sess |
because you are joining |
20:03 |
|
sess |
you need to fetch join |
20:03 |
|
sess |
joins are NOT loaded into the resultset |
20:03 |
|
sess |
only fetch joins are |
20:03 |
|
Naros |
ah; doh |
20:03 |
|
sess |
took me a while to realize when starting out aswell |
20:03 |
|
sess |
i still cant see any reason not to use the join data |
20:04 |
|
sess |
or well i guess you dont want the data always, might just want to reduce the data amount with where statements |
20:04 |
|
Naros |
ty, works like a champ. |
20:04 |
|
Naros |
Most of my associations, even the m-to-one are flagged as lazy because some of the views the model generates can be quite large. |
20:05 |
|
Naros |
and to avoid the overhead we just want to get the data we specifically need only. |
20:05 |
|
Naros |
sometimes even saving a few hundred milliseconds to these people is critical :P |
20:06 |
|
cem_ |
sfisque i cant view my tsv correctly in excel |
20:07 |
|
sfisque |
you might have to close it, and open a empty sheet and do an "import" |
20:07 |
|
sfisque |
i do not think xcel recognizes tsv natively |
20:09 |
|
sess |
fetch joining can easily improve performance by 1000% |
20:19 |
|
|
SLovenberg joined ##javaee |
20:29 |
|
cem_ |
sfisque: arigato correct ? |
20:29 |
|
sfisque |
mr. roboto? |
20:30 |
|
sfisque |
not sure of the question |
20:30 |
|
cem_ |
tuvm |
20:31 |
|
sfisque |
np :-) |
20:39 |
|
cem_ |
sfisque: i get question mark characters :( |
20:41 |
|
|
[[thufir]] joined ##javaee |
21:39 |
|
|
austurist joined ##javaee |
22:00 |
|
sfisque |
so it appears "they" are using spring http invoker for the remote side. from what i've read, it's java serialization over http. before i go pouring through the spring source code, could anyone elucidate that for me? |
22:01 |
|
whartung |
what do you mean? |
22:02 |
|
sfisque |
what does the serialization look like? is it xml serialization (which java supports natively) or is it the other standard, "binary serialization"? does spring push any headers, or is it all in the "http payload"? |
22:02 |
|
whartung |
I can't say for sure, but sounds like generic, java serialization |
22:02 |
|
whartung |
stuffed in to a byte array and shipped over via HTTP |
22:03 |
|
sfisque |
aye, i agree. i was hoping someone's actually dug into it at some point, before i go traipsing through the code. |
22:03 |
|
sfisque |
fact over belief :-) |
22:04 |
|
whartung |
ByteArrayOutputStream boas = new …; ObjectOutputStream oos = new …(boas); oos.writeObject(payload); sendHttp(url, baos.getBytes()); |
22:04 |
|
whartung |
something like that |
22:05 |
|
whartung |
i'm sure it's fine, as long as your jars are synced up. if that's an issue, I'd go with something like XML or JAX-WS where the serialization is a bit more formal |
22:05 |
|
sfisque |
right but you can configure .writeObject() to return xml or binary. java has native support for both xml and binary serialization |
22:05 |
|
|
kotten joined ##javaee |
22:05 |
|
sfisque |
i guess i'll dig through the spring soure |
22:05 |
|
whartung |
I know they were looking in to that for Swing, didn't know they made it "generic" (rendering to XML that is) |
22:06 |
|
whartung |
I would expect they would use binary |
22:06 |
|
sfisque |
i can't. i dont have control on the remote side. we're consuming "their" service. i just want to see if ic an do it without swalling spring libs unnecessarily (regression + bloat footprint) |
22:06 |
|
whartung |
it's a better technique |
22:06 |
|
whartung |
well set up a "dumb" listener, and suck in a payload and take a look at is |
22:06 |
|
whartung |
just dump it to a file |
22:06 |
|
whartung |
then you can try and decode it over and over |
22:06 |
|
sfisque |
i'll just check out the source from their repo and take a look |
22:07 |
|
sfisque |
basically i'm being lazy and was hoping someone has already "been down this road" |
22:07 |
|
sfisque |
but i'm prepared to go digging :P |
22:07 |
|
whartung |
it'll be obscured underneath 17 different interfaces, none of which "do anything" because the actual implementations are in completely different jars, as far away from the interface definitions as possible |
22:07 |
|
sfisque |
ROFL |
22:08 |
|
sfisque |
i feel you share my disdain of spring |
22:08 |
|
sfisque |
>.< |
22:08 |
|
whartung |
I hate reverse engineering interface based code. Lots of do nothing to nowhere |
22:08 |
|
whartung |
"Oh, well, there's 3 classes that implement that -- which would you like"? Like I have any idea whatsoever. |
22:09 |
|
sfisque |
yeah. i know that pain |
22:31 |
|
sfisque |
so it looks pretty straight forward: |
22:31 |
|
sfisque |
http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/net/HttpURLConnection.java#HttpURLConnection con = http://grepcode.com/file/repo1.maven.org/maven2/org.springframework/spring-web/3.0.3.RELEASE/org/springframework/remoting/httpinvoker/SimpleHttpInvokerRequestExecutor.java#SimpleHttpInvokerRequestExecutor.openConnection%28org.springframework.remoting.httpinvoker.HttpInvokerClientConfiguration%29 |
22:31 |
|
sfisque |
http://grepcode.com/file/repo1.maven.org/maven2/org.springframework/spring-web/3.0.3.RELEASE/org/springframework/remoting/httpinvoker/SimpleHttpInvokerRequestExecutor.java#64 |
22:31 |
|
|
sfisque joined ##javaee |
22:31 |
|
sfisque |
so yeah it looks like raw byte code in the body |
22:31 |
|
whartung |
only thing that makes sense, really |
22:31 |
|
sfisque |
i never assume other people think "simply" |
22:32 |
|
sfisque |
i've paid for that assumption in the past |
22:32 |
|
whartung |
:) |
22:33 |
|
sfisque |
as a mathematician first and a developer second, i have a wierd fetish for minimalistic coding |
22:34 |
|
whartung |
http://xkcd.com/1270/ |
22:34 |
|
whartung |
I love the mouse over |
22:35 |
|
pdurbin |
+1 |
22:37 |
|
sfisque |
yah i saw that one. makes me chuckle. though i have to admit, i've not embraced functional programming, but that's probably because i've not had a need for it yet. though i do keep trying to find reasons to use prolog in my career, but i always hit a wall on the justification beyond, "because it would be really cool..." |
22:39 |
|
* pdurbin |
just hit the prolog chapter in http://pragprog.com/book/btlang/seven-languages-in-seven-weeks |
22:39 |
|
whartung |
we'll get more of it in J8 |
22:40 |
|
sfisque |
yah with closures |
22:40 |
|
whartung |
do we actually get closures in J8? |
22:40 |
|
pdurbin |
depends on who you ask :) |
22:41 |
|
pdurbin |
they are impure |
22:41 |
|
cem_ |
translator >closures are very very old ... it may be new in java :) |
22:42 |
|
whartung |
pretty much everything is very, very old... |
22:42 |
|
|
kotten joined ##javaee |
22:43 |
|
sfisque |
we're also getting Functions as a top level object type, which IMO is LONG overdue |
22:43 |
|
sfisque |
even without closures, java should have had that 10 years go or more |
22:44 |
|
whartung |
the new stuff will be nice |
22:44 |
|
sfisque |
would have saved so much time boiler plating objects so we could do runtime method invocations |
22:44 |
|
pdurbin |
sfisque: netbeans 7.4 supports the java 8 preview ya know. will automatically prompt you to convert anonymous inner classes to lambdas |
22:44 |
|
sfisque |
nifty |
22:45 |
|
pdurbin |
or so I've heard on the netbeans podcast |
22:45 |
|
sfisque |
i'm not too keen on closures, but being able to do things like method( Function f ) rather than method( InterfaceWithMethod x ); |
22:45 |
|
sfisque |
makes me happy |
22:45 |
|
whartung |
yea |
22:45 |
|
whartung |
closure are very nice |
22:45 |
|
sfisque |
more C-like |
22:46 |
|
sfisque |
actually do things like c-style vector tables |
22:46 |
|
pdurbin |
not sure what that means |
22:47 |
|
whartung |
dispatching against an array of function pointers |
22:47 |
|
sfisque |
imagine Function[ 100 ] vectorTable; |
22:47 |
|
sfisque |
vectorTable[ 78 ]( x, y, z ); |
22:48 |
|
sfisque |
basically the closest you get to java reflection in the C world |
22:49 |
|
pdurbin |
is this a decent write up? http://babbage.cs.qc.cuny.edu/courses/cs200/dispatch.html |
22:50 |
|
sfisque |
that looks like it captures the essence |
22:50 |
|
whartung |
not really |
22:50 |
|
pdurbin |
heh |
22:50 |
|
sfisque |
lolz |
22:50 |
|
whartung |
it's not a array of function pointers, it doesn't apply anything dynamically either |
22:51 |
|
sfisque |
currently in java we'd have to have InterfaceWithMethod[ 100 ] vectorTable; |
22:51 |
|
sfisque |
vectorTable[ 67 ].methodInInteface( x, y , z ); |
22:51 |
|
whartung |
right |
22:51 |
|
sfisque |
so java has the facility but it's wierdly indirected because we dont have top level functions |
22:52 |
|
sfisque |
from what i gather from what i've read on 8, you can have a Function reference and then invoke it directly without an enclosing instance |
22:53 |
|
sfisque |
which will make utility classes obsolete |
22:53 |
|
sfisque |
finallyt |
22:54 |
|
whartung |
yea |
22:54 |
|
whartung |
it makes tossing anon functions around much more nimble |
23:52 |
|
|
scripty joined ##javaee |
23:52 |
|
scripty |
yo |
23:52 |
|
whartung |
o/ |
23:57 |
|
scripty |
hey gnutrahw |