greptilian logo

IRC log for #javaee, 2013-10-08

Please see http://irclog.greptilian.com/javaee for which days have been logged.

| Channels | #javaee index | Today | | Search | Google Search | Plain-Text | plain, newest first | summary

All times shown according to UTC.

Time S Nick Message
00:15 sfisque joined ##javaee
00:39 sfisque1 joined ##javaee
01:03 grug_ left ##javaee
05:04 sess joined ##javaee
05:45 dangertools joined ##javaee
06:00 Moogly2012 joined ##javaee
06:07 sess joined ##javaee
07:23 pdurbin joined ##javaee
09:38 Technodrome joined ##javaee
09:39 Technodrome left ##javaee
09:56 Quest joined ##javaee
10:00 Quest whats usually the prefered tool to make jdbc pooled connections.  is it org.apache.commons.dbcp.ConnectionFactory;  import org.apache.commons.pool.ObjectPool;   ? no built in libs in java?
10:08 sess Quest:  why not let the container handle it?
10:09 Quest you dont know the advantages of pooling?
10:09 Faux The container provides the pool, if you want to do stuff the legacy way.
10:09 sess how is that relevant? The advantages are the same
10:10 Quest creating connections is resource wanting
10:10 Quest having a fix number of pool that expands or contracts.  resuing connections already made.... thats what I was refereing when i said connection pool
10:11 Quest the container dont do it by default i gues
10:11 sess i know
10:11 sess and my comment still stands
10:11 Quest thats why libs like apache come int
10:11 Quest in*
10:11 sess im pretty sure containers pools connections by default
10:11 Quest pool? in what way different from the apache libs pool?
10:11 sess or it depends on what you inject perhaps
10:12 sess im not an expert since i just use JPA where thats taken care of behind the scenes
10:12 sess but its less work just injecting a connection
10:12 sess ¨from a pool that the container defines and takes care of
10:12 Quest hm
10:13 sess http://docs.oracle.com/javaee/6/tutorial/doc/bncjj.html
10:13 sess read some of this
10:13 sess you just define a data source
10:13 sess then ask the container for a connection
10:13 sess or an entitymanager in the case of jpa
10:14 Quest hm
10:14 sess or it seems like you inject a datasource
10:14 sess but you can probably get a connection from that easily
10:17 Quest how would the container manage the connection pool as stated in your stated link.? I mean how may connections are of default and how can i change things ?
10:17 sess what container are you using? Jboss?
10:17 Quest tomcat
10:18 sess ah
10:18 sess tomcat even uses apache commons pool
10:18 sess you can configure it in context.xml
10:18 Quest sess oh, in the background?
10:18 sess both connection string etc and pooling config
10:19 Quest so how many connections and how to change things
10:19 sess http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html#Database_Connection_Pool_(DBCP)_Configurations
10:19 sess you can set maxActive, maxIdle, maxWait
10:19 Quest hm
10:22 Quest I am just watching a prebuild app that has a class that uses those and the container is tomcat. now if tomcat already does such pooling   why the app is doing it again
10:22 sess perhaps it's old
10:23 sess i really cant see any reason to handle connection pool by yourself these days
10:23 Quest hm... it is old. yes
10:24 sess http://tomcat.apache.org/tomcat-6.0-doc/jndi-resources-howto.html#JDBC_Data_Sources
10:24 sess this seems like a good introduction
10:24 sess also shows the code to get a connection
10:24 Quest sess do you know when apache tomcate started using jdbc connection pooling by default?
10:24 sess by default compared to what?
10:24 sess i doubt they ever had a system without pooling
10:25 Quest hm....... I wonder why it was made by custom means then
10:25 sess perhaps tomcat 5 or older did not support datasources at all
10:25 sess and you had to implement them by yourself
10:26 Quest sess does that means that in that app, tomcat will also pool connections no matter the said class pools it or not. so that means there will be 2 pools but on main real pool (tomcats default
10:27 sess tomcat only creates a pool if you configure it too
10:27 sess it would be impossible for it otherwise since it wouldnt know anything about the database
10:27 Quest oh. so tomcat only creates a pool if you configure it to make a pool. otherwise it does not creates a pool?
10:27 sess correct
10:27 Quest right.
10:28 Quest so thats why I think they did it. so the app gets generic even if jboss or some other container replaces tomcate later on.
10:28 Quest correct guess^?
10:29 sess even using tomcats datasources, switching container would be extremly easy
10:29 sess just configure the datasource in jboss instead
10:29 sess no code changes needed
10:29 Quest hm
10:29 Quest which one would be better? I think custom made as we can introduce more custom code in it.
10:30 sess personally, I dont see any reason to not let the container handle it
10:30 sess less chance of doing things wrong
10:30 Quest ya
10:30 sess im not sure what kind of custom code you would want there
10:30 Quest that too
10:30 sess and if custom code is a good idea
10:30 Quest e.g counting no. of connections used
10:31 sess if bet you can configure the container for stuff like that
10:31 Quest sysouting i mean
10:31 sess or asking the pool
10:31 Quest hm.
10:31 Quest ok..
10:31 sess also you still write the code that gets the connection from the data source
10:31 sess ¨so you can do stuff there
10:32 sess the cool thing with containers is also that if you want to deploy a 2nd application using the same database
10:32 sess they can share the same connection pool
10:33 Quest hm
10:34 Quest thanks for enlightening
10:35 sess np :)
10:35 MegaMatt joined ##javaee
12:14 Quest joined ##javaee
12:20 Quest silly question as static has no instance. but looking for tricks. -ChanServ- Flags +o were set on sess in ##javaee.
12:20 Quest shit.
12:21 Quest silly question as static has no instance. but looking for tricks. Is there a way to make this line of code generic for any class. ? public static Logger logger = Logger.getLogger(UserRegAction.class);
12:22 sess not that i know of, i usually have that in each class
12:22 Quest k
12:23 Quest sess as a default behaviour of logger.debug("message"); only sys outs that to console and not wirte it on any file. correct ?
12:23 sess not sure
12:23 sess i dont remember log4js default config
12:24 Quest k
12:26 tjsnell depends on logging framework
12:28 Quest why use it on each class. why not just declare in one class and inherit all other classes from it?
12:28 Quest tjsnell log4j
12:28 Quest is a framework
12:29 sess Quest:  because then its all the same logger
12:29 sess you might aswell declare Log.java then and have a public static logger there
12:32 sess you declare it in each class to get categories
12:32 Quest sess why not the same logger?
12:33 sess because you lose categories then
12:33 Quest oh. so its only for catagorization
12:33 sess lets say you want debug logging
12:33 sess for a single class
12:33 Quest k
12:33 sess thats impossible if they share category
12:33 tjsnell it's exactly for categorization
12:33 tjsnell that's vital
12:33 Quest sess do you have a log that you can show me made by log4j with many catagories?
12:33 Quest as you said you use it a lot
12:33 Quest tjsnell k
12:34 tjsnell any log4j log file
12:34 Quest ya. any
12:34 tjsnell no
12:34 sess Quest:  use what a lot?
12:34 tjsnell any log file written by anyone with a smidgen of a clue has many catagories
12:34 sess yes
12:34 tjsnell if one of my devs used the same thing in every logger instance I'd probably fire them
12:35 tjsnell but then again I would've never hired them
12:36 Quest_ joined ##javaee
12:37 Quest_ disconeected
12:37 Quest_ Quest> can i see a sample
12:37 Quest_ * Disconnected
12:38 * Quest_ says by to Quest_
12:38 * Quest_ says by to Quest
12:38 * Quest_ says bye to Quest
12:38 tjsnell start tomcat
12:38 tjsnell look at log file
12:39 Quest_ ah.
12:40 * Quest_ forgot tomcat also uses log4j
12:42 tommmied joined ##javaee
12:44 acuzio Quest: is tjsnell again creating problems ?
12:47 jieryn joined ##javaee
12:47 jieryn joined ##javaee
12:51 tjsnell I'm awake
12:51 tjsnell so yeah
12:59 Quest acuzio :) I think you both should shake hands some day
13:06 kotza joined ##javaee
13:40 JAZ1976 joined ##javaee
13:40 Naros joined ##javaee
13:41 tommmied joined ##javaee
13:43 kobain joined ##javaee
14:09 kobain_ joined ##javaee
14:13 pdurbin whartung: you've done https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPJavaInstall before?
14:46 Quest joined ##javaee
14:47 acuzio shake hands with tjsnell never -
14:47 Quest acuzio, :)
14:47 tjsnell we tend to hug
14:48 Quest iam getting 405 Method not allowed and 406 not acceptable error for getting a json object. http://pastebin.ca/2464130
14:48 acuzio Quest: wow json
14:49 sess Quest:  try removing headers="Accept
14:49 Quest did that before too
14:49 sess also
14:49 sess your urls looks wrong?
14:49 sess your mapping specifies 4 parts
14:49 Quest wrong. no i gues
14:50 Quest which part?
14:50 sess while the urls in the top specifies only 3
14:50 sess create/board/3/vertical
14:50 sess create/{parent}/{parentId}/{boxType}/{boxTitle}
14:50 Quest no
14:50 Quest create is static. all others are values
14:50 sess i did not say it was
14:50 sess count the /
14:51 Quest 4 /s
14:51 sess on the bottom
14:51 sess 3 on the top
14:51 Quest sorry, didnt got you
14:51 sess so there doesnt seem to be any mapping for that url
14:52 Quest url: "${pageContext.request.contextPath}/bo​x/create/board/3/vertical/MyBoxTitle",     justifies @RequestMapping (value = "/box/create/{parent}/{pare​ntId}/{boxType}/{boxTitle}"
14:52 sess on the other hand it looks like 4 in the javascript
14:52 sess so whats up with the requests logs at the top?
14:53 acuzio sess: are you Fubar^ ?
14:53 sess uh no?
14:53 acuzio are you the new op ?
14:54 sess "the" is a strong word
14:54 acuzio i thought "you" was strong - when did you become an op ?
14:54 sess earlier today
14:54 Quest sess,  detailed error http://pastebin.ca/2464131
14:55 acuzio sess: is it your birthday ?
14:55 sess acuzio:  no
14:55 acuzio sess: so whats the occasion .,
14:55 sess Quest:  do you have jackson included?
14:55 sess as a library
14:55 acuzio Michael is a library /
14:55 sess acuzio: none really
14:56 acuzio sess: who gave you the op ?
14:56 sess Quest did
14:56 Quest <groupId>org.codehaus.jackson</groupId>
14:56 Quest <artifactId>jackson-mapper-asl</artifactId>
14:57 Quest only included in maven pom
14:57 acuzio Quest: why is sess an op ?
14:57 sess Quest:  try removing @ResponseBody and replacing it with ModelAndView
14:57 sess and see if you still get 406 errors
14:57 sess acuzio:  what's the big deal?
14:58 Quest sess,  hm.
14:58 acuzio sess: do you not know ? in this channel being an op is a great honor , plus you can kick tjsnell whenever
14:58 Quest lol
14:58 sess sounds amazing
14:58 jieryn left ##javaee
14:59 sess whoever that is
14:59 Quest sess,  so i should return ModelAndView and remove @ResponseBody?
14:59 acuzio do you not know the history of this channel sess ?
14:59 sess Quest:  yeah, try to use it like it was a normal method for a normal page
14:59 sess acuzio:  i joined like a few days ago
15:00 Quest sess,  i wonder why on line 6 of http://pastebin.ca/2464131 . its post and not get
15:00 acuzio sess: aaah , that explains it
15:00 sess oh yeah i thought i saw POST somewhere, then looked at the js that was a GET and forgot about it
15:00 Quest so whats wrong
15:00 sess perhaps your "type" is wrong
15:00 Quest type?
15:01 Quest its type:"get"
15:01 sess in jquery
15:01 sess get is default so it doesnt have to be specified even
15:01 sess otherwise it looks correct hmm
15:02 sess Quest:  if you just type the url in your browser
15:02 sess does it work?
15:02 Quest i would comment out type: get then and try
15:02 sess i.e json should show up as the page
15:02 Quest hm wait
15:03 tjsnell unlike others bans and kicks don't get my panties wadded
15:03 Quest haha. HTTP Status 500 - Could not write JSON: failed to lazily initialize a collection of role: web.entity.Boards.childBoxList, could not initialize proxy - no Session (through reference chain: web.entity.Boxes["parentBoard"]->w​eb.entity.Boards["childBoxList"]); nested exception is org.codehaus.jackson.map.JsonMappingException: failed to lazily initialize a collection of role: web.entity.Boards.childBoxList, could not initialize proxy - no Session (throu
15:03 Quest gh reference chain:
15:03 Quest sess,  i typed the link on url bar directly ^
15:03 sess ok so if you fix that the problem just seems to be with jquery
15:04 acuzio Quest: dont use JSON , its for the gays
15:04 Quest sory?
15:05 Quest sess,  with jqery
15:05 acuzio its for the gays
15:05 sess Quest:  something in your code causes you to post rather than GET
15:05 Quest acuzio,  i mean sess.  what do you mean by "seems to be with jquery"
15:05 Quest a minut
15:05 sess as in youre using jquery to make the request
15:06 Quest sess,  but I have an other error 500 too
15:07 sess didnt we go over lazy initialization a few days ago
15:07 Quest yes. i got that but might it not be the reason only and not jquery
15:08 sess no, because when doing the ajax you get a 506 error
15:08 sess while this gives a 500 error = some random exception was thrown
15:08 sess 506 means something is wrong with the mapping
15:09 Quest i commented out type: get in jquery and now I only get 500 (Internal Server Error)
15:09 Quest I would fix it and return
15:09 Quest sess,  thanks!
15:10 sess sounds like that was it then
15:10 sess perhaps it is case sensitive
15:10 Quest yes
15:10 sess so type: "GET" was required
15:10 Quest hm. may be
15:10 sess or none at all
15:41 Quest sess,  this controller method should not give a lazy initialization error. I have done all in service transactional boundaries. http://pastebin.ca/2464157
15:42 sess Quest:  which line throws the exception?
15:43 Quest dont see the line
15:43 Quest in the error
15:43 sess uh your service class does basicly nothing now
15:44 sess why not set the parent in the controller
15:44 sess and you skipped the important method: getBoardById
15:47 Quest this will be a lot of code http://pastebin.ca/2464162
15:47 Quest sess,  why the service does nothing  now?
15:47 sess telling the line where the exception occured
15:47 sess would help
15:47 Quest I dont see the line in the error
15:47 sess Quest:  youre making a whole method for just assigning a simple variable
15:47 sess seems unnecessary
15:47 sess no line number in logs?
15:47 sess in that case you are logging in a bad way
15:48 Quest heres the full error http://pastebin.ca/2464163
15:48 Quest sess,  its tomcate logging. not mine
15:48 sess oh its Jackson that throws it
15:49 sess Jackson tries to convert all data
15:49 sess to json
15:49 sess so you have to make sure everything is initialized
15:49 Quest or set to null
15:49 Quest hm
15:49 sess that would be a hack, but that would work in theory yes
15:50 sess perhaps you can annotate for jackson that you do not wish to convert some lists
15:50 Quest sess,  but why jackson is worried about lazy init and sessions............ Could not write JSON: failed to lazily initialize a collection of role: web.entity.Boards.childBoxList, could not initialize proxy - no Session
15:50 sess or you can make another class that Jackson can convert
15:50 sess that does not contain the list
15:50 sess because jackson is reading your entity
15:50 sess and its not initialized
15:51 sess calling getCollection will always throw a lazy exception if its not initialized or fetched in the current transaction
15:54 Quest hm
15:54 sess I think the proper design here would to make another class
15:54 sess BoxBean or whatever
15:54 Quest rebuilding
15:54 sess that you populate in the service layer
15:55 sess that way, lazy initialization exception cant occurs
15:55 sess -r
15:55 sess -s
15:59 Quest changed the controller but still same error http://pastebin.ca/2464167
16:00 sess Quest:  you could also use something like this https://github.com/FasterXML/jackson-datatype-hibernate
16:00 sess i think it can ignore non loaded collections
16:01 sess im not sure the set null method actually works
16:01 Quest ya but i wonder why its giving lazy init error now when all collections are null in the  returned Boxes object?
16:02 Quest it should work. why not
16:02 sess i think its the implementation of Boxes that decides when the exception should be thrown
16:02 sfisque joined ##javaee
16:02 sess rather than the value of the collection
16:02 sess or something
16:02 sess not sure of the specifics
16:02 whartung pdurbin: I don't think I even installed the Shib servlet handler, and if I did it was 4-5 years ago
16:02 Quest hm
16:02 sess either way it's an ugly solution
16:02 Quest sess,  last resort is to try a bean now
16:02 Quest right?
16:03 sess you could also check out my link
16:03 sess that disables json for uninitialized collections
16:03 Quest which class in it
16:03 sess http://stackoverflow.com/questions/7440613/is-there-a-way-to-make-jackson-jsonize-only-fetched-lazily-loaded-objects
16:03 sess https://github.com/FasterXML/jackson-datatype-hibernate
16:04 Quest @JsonIgnore  might help?
16:04 sess dunno, never saw that annotation
16:05 Quest public @ResponseBody @JsonIgnore  Boxes createBox
16:05 Quest k
16:06 sess that doesnt look right
16:06 sfisque so here's an interesting question because i cannot find definitive documentation.  so, with the recent JSRs for EE, you can dual purpose a class as both @Stateless(ful) AND @Namee with a CDI scope (e.g. @SessionScoped).  i'm curious how that plays out since EJB "state" is not coupled to the web session.  i'm probably going to build a test war and check it out, but i'm curious what others have found doing such a thing
16:06 whartung I haven't got that far in to EE7 to explore that sfisque
16:06 pdurbin whartung: no worries... I'm getting a little bit of help at http://irclog.perlgeek.de/shibboleth/2013-10-08
16:06 pdurbin sfisque: you mean @Named, right?
16:06 sfisque yes
16:06 sfisque typo
16:07 whartung Would think that even though they're the same "bean", they'd be two different instances in this case.
16:07 sfisque that's my conceptual take
16:07 sess probably no JTA activated?
16:07 sess on the CDI one
16:07 sfisque because we have a dev here who wants to tag all the EJBs as @Named to work around something he's working on.
16:07 Quest sess,  hm. will try the bean resort after dinner break. thanks again!
16:08 sfisque and i'm very resistant to it
16:08 sfisque i see it playing huge havoc
16:08 sess never heard of anyone using @Named on and EJB
16:08 sess an*
16:08 sfisque me either
16:08 whartung yea I just don't have the CDI experience to really explore that. what problem is he trying to solve?
16:08 sess either way it sounds horribly wrong
16:08 sfisque but they do offer an example of it in the JSR discussion exampe on oracle.com
16:09 sfisque he's trying to create an anotation that does some AOP stuff, and it doesn't work properly on EJBs (because reflection is dicey since its' all pooled and heavy proxied)
16:10 sfisque basically (imo) misusing a platform feature
16:10 sess well if it doesnt work with EJBs, using @Named will probably fuck it up badly
16:10 sfisque as a workaround
16:10 sfisque that's my thought
16:10 sfisque newbies…. /sigh
16:10 sess but wait, AOP doesnt work on EJBs?
16:10 sfisque :P
16:10 sfisque it woudl depend on how/what you're doing
16:11 sess ah you mean he's doing something very specific
16:11 sfisque reflection is "tricky" when you cross the boundary into ejb
16:11 sfisque yes
16:11 sfisque and aop relies heavily (generally) on reflection
16:11 whartung yea, I can see AOP having kittens with EJBs, but then we have Interceptors, which are EE blessed AOP for EJBs
16:11 sess I assume he was using interceptors
16:12 whartung I should say, having kittens with INSTANCES of EJBS
16:12 whartung but he may be doing some dynamic on the fly shenanigans with AOP, interceptors tend to be a bit static
16:12 sfisque he's not using the "mandated" lifecycle interceptor.  basically trying to wire up his own
16:12 whartung ok. why?
16:12 sess oh that sounds
16:12 sess lovely
16:12 whartung haha
16:13 sfisque because he's young and tries to do "cute" stuff
16:13 sfisque you know the profile
16:13 whartung o
16:13 whartung k
16:13 sess stuff made by the nice java people is obviously bad
16:13 sess so you should make your own implementations
16:13 sess of everything
16:13 * sfisque nods solemnly to sess
16:14 whartung that behavior can be fixed… http://www.amazon.com/Remote-Dog-Training-Shock-Collar/dp/B003YLETZY
16:14 sfisque ROFL
16:14 sfisque i was thinking more along the lines of a LART
16:15 sess :D
16:15 sfisque like… say… a toaster oven to the forehead
16:15 sfisque it gives such a satisfying >thud<
16:15 whartung or an old candy colored iMac
16:15 sfisque :-)
16:43 pdurbin just moved from ant to maven: https://github.com/IQSS/dvn/commit/8ca34ad
16:44 sfisque irc, there is a betty ford program for that
16:44 sfisque :P
16:44 sfisque ant.   the gateway drug
16:46 pdurbin :)
16:47 pdurbin death to ant
16:47 pdurbin ;)
16:47 whartung I  like ant
16:47 pdurbin i know i know
16:47 sfisque i'm ok with maven, but i do perfer ant
16:47 sess maven should have been named ant eater
16:47 whartung for the most part I like imperative systems over declarative ones
16:47 sfisque maven automates better, ant gives more power
16:47 sfisque ROFL sess
16:47 sess with great power
16:47 sess comes great idiots
16:48 sfisque hey, i resemble that remark!!
16:49 tommmied1 joined ##javaee
16:55 pdurbin now to re-write our dev guide. should be shorter :)
17:02 MegaMatt pdurbin, wonder if you know my friend Vanessa Venti ..
17:03 pdurbin javaeebot: lucky Vanessa Venti
17:03 javaeebot pdurbin: http://www.linkedin.com/in/vanessaventi
17:03 pdurbin MegaMatt: nope
17:04 MegaMatt you must have common linked in connections via harvard, I'd assume
17:04 pdurbin MegaMatt: "3rd" it says
17:04 MegaMatt right on
18:01 Quest sess,  it works with an entity bean but not with the real entity. http://pastebin.ca/2464227
18:01 sfisque entity bean vs real entity
18:01 sfisque what does that mean?
18:01 sess isnt entity beans ejb2 stuff
18:01 sess or even older
18:01 Quest well.
18:02 sfisque aye, but what is a "real entity" then?
18:02 sfisque vs an entity bean
18:02 Quest sfisque,  my entity has some lists in it. even if i make them null and not fetch them. it gives the stated 500 error. but if i return an identical bean instead. it works fine.
18:02 Quest any help for this spring jackson, and lazy initialization error? http://pastebin.ca/2464227
18:02 bruce-zu joined ##javaee
18:03 sess i already told you the reason
18:03 sess and the solution
18:03 Quest sfisque,  real would have @Entity  and other would be plain pojo
18:03 Quest sess,  but there should be some better solution
18:03 sess you could load the data
18:03 sess or use the plugin i linked
18:04 sess 3 solutions, all of them fine
18:04 Quest sess,  load data> what if theres no data in the child lists
18:05 sess doesnt matter
18:05 sess try to load it
18:05 Quest load? how
18:05 Quest in service methods?
18:05 Quest what do you mean by load?
18:05 sess yes
18:05 sess using the getter
18:05 Quest hm
18:06 sess before closing the transaction
18:06 Quest why not just make the childLists         box.setChildList(null) ; in service method?
18:06 Quest that would suffice too i gues?
18:06 sess no
18:07 sess that might delete data
18:07 sess from the db
18:08 sess Object o = entitymanager.find(myClass.class, id)
18:08 sess Hibernate.initialize(o.getLazyCollection)
18:08 sess return o
18:08 sess done
18:10 syncsys_ joined ##javaee
18:11 Quest disconnected after <sess> no
18:11 Quest <Quest> am?
18:11 sess [20:08] <@       sess> | that might delete data                                                                                                                                                    |
18:11 sess [20:08] <@       sess> | from the db                                                                                                                                                               |
18:11 sess [20:09] <@       sess> | Object o = entitymanager.find(myClass.class, id)                                                                                                                          |
18:11 sess [20:09] <@       sess> | Hibernate.initialize(o.getLazyCollection)                                                                                                                                 |
18:11 sess [20:09] <@       sess> | return o                                                                                                                                                                  |
18:11 sess [20:09] <@       sess> | done
18:11 Quest hm
18:14 Quest one question:. my app is of such a strategy that one box may have more boxes. and those may have more. and it goes on and on.    Now if i get the box object for json and if its not getLazyCollection . I would need to get ALL levels of child box list(S) in order for jackson not to make any errors?
18:17 sfisque so you're calling a VO a "real entity".
18:18 sess Quest:  then initialization might not be the best solution
18:18 Quest VO?
18:18 sess checkout that jackson hibernate plugin
18:19 sfisque VO == value object.  a pojo that is just for holding data (no business methods)
18:20 Quest sfisque,  VO != entity      .     VO.setVar(entity.getVar);
18:21 sess sfisque:  he never claimed a vo was an entity
18:21 sess i think
18:21 sfisque a VO can be an entity (if you bear in mind that the only thing that makes an entity special is the annotations, and all there really is data + mutator/accessors)  but VO's generally are more "context driven" and don't necessarily map to a schema
18:21 Quest Vo is same identical to entity but without @Entity
18:22 sfisque you may have a RestPerson bean that is a VO that subsets your Person entity with just the fields the Rest endpoint is exposing
18:22 sfisque and a ViewPerson that is used in a jsf page that has a different subset of fields
18:23 sfisque and a MessagePerson that is a JMS payload with a different subset of fields
18:23 sfisque they're all pojos but the entity maps to your schema, and the VO's probably do not
18:24 sfisque but in a simplified app, you can get away with treating your entity as a VO
18:24 sfisque because that's really all it is + some annotations to make it special
18:24 Quest sfisque,  thats what was creating problem if you see my code. I dont want double classes and hasle
18:25 sfisque you have to be careful though.  some EE annotations can play havoc with other thirdparty endpoint frameworks.
18:25 sfisque that's why VO's are generally better.  it strips off the JPA/JTA stuff and just hands a pojo to whatever facility is doing the rendering/export/etc.
18:26 sess ´for filling them with data, there are mapping frameworks
18:26 sess that can copy via reflection
18:26 sess because copying values to a VO is a bitch
18:27 sfisque aye, apache digester is one such lib
18:27 sess that said i enjoy letting my true domain classes flow throughout the application as much as possible
18:27 sfisque jackson is another
18:27 sess jackson does bean to bean mapping?=
18:27 sess thought it was only bean to json
18:27 Quest sfisque,  I can just do           Entity e = getEntityBySomeServiceMethod ()                   Entity VOe =  e;       return e;
18:27 sfisque oh, you meant bean to bean
18:27 sfisque i misunderstood
18:27 Quest return VOe; *
18:28 sess uh
18:28 sess that does nothing
18:28 sfisque aye, that just assigns the pointer
18:28 sess ive seen you try something like that before, i think you missunderstand something basic in java
18:28 sfisque you'd have to do a deep clone
18:28 sess VOe is still e
18:28 sess the same instance
18:28 sess changes will apply to both of them
18:29 sfisque that's the annoying part of java, it hides the danger of pointers
18:29 sess not really annoying
18:29 sess and having pointers here wouldnt help
18:29 sfisque well, it would be more obvious to him what that assignment did
18:30 sess it would do the same thing in c
18:30 sess unless it was a primitive
18:30 sfisque in C yes, but C isnt oo.  in c++ you can override the operator to do deep clone if you wanted to
18:31 Quest sfisque,  I can just do           Entity e = getEntityBySomeServiceMethod ()                   Entity VOe =  e.clone();       return VOe;
18:31 sess overloading = sounds like an extremly bad idea
18:31 sfisque depends.. clone() is protected
18:31 sess clone returns an instance of the same class
18:31 sess so that wont help
18:31 sess or well you could return an instance of the same class with null in the collections i guess
18:32 sess could work in theory
18:32 sfisque it woul still fail unless they share an interface or one extends the other
18:32 sfisque class cast exceptin
18:33 sess what would be casted?
18:33 sfisque VO could extend entity and make certain accessor/mutators private
18:33 sess in Entity e = e.clone()
18:33 sess if it returns Entity
18:33 sfisque clone() returns an object
18:33 sess i mean skipping the VO class
18:33 sfisque it's defined in Object
18:33 sfisque unless they changed it to be <T> in recent iterations
18:33 sfisque or <?>
18:33 sfisque <T> would still have classcast issue
18:34 sess probably not
18:34 sess but just cast it then
18:34 sess Entity e2 (Entity)e.clone()
18:34 sfisque still throws excetpion unless they are in the same inheritence change
18:34 sfisque ***chain
18:34 sess though its a bad solution to null the collections anyways
18:34 sess its the same class :*V
18:34 sess thats pretty close in the inheritance chain id say
18:34 sfisque you cant do Point p = (Point) r.clone // if r is a Rect
18:34 sess no
18:35 sess im speaking of cloning the SAME class
18:35 sfisque right but then doing an assignment would fail
18:35 sfisque if the result is not in the same chain
18:35 sess god
18:35 sess the result is the same class aswell
18:36 sess Entity e1 = entitymanager.find(Entity.class, 1);
18:36 Quest I think in order to clone an object i need to implement clonable interface.  I think iam better of with other solutions
18:36 sfisque i was referring back to his VO v = entity.clone();
18:36 sess Entity e2 = (Entity)e1.clone();
18:36 sess VO would not work with clone no
18:36 sfisque which woudl only work if VO extended En or a shared interface
18:36 sess yeah
18:37 sfisque ok.  now we understand each other :-)
18:37 sfisque we had a disconnect
18:37 sfisque i wasnt disagreeing with your example, i was referring back to Q's ex
18:42 * Quest realizes he have many concepts to understand as a fresher
18:43 Quest it is making very clear sense now by the way of concepts learned here
18:44 sfisque :-)
18:48 Quest If on line 25 of http://pastebin.ca/2464227          i did box.setType(boxType);    and it did worked fine with no errors.  so i could also do   box.setChildBoxList(null);   on line 26 also ?
18:49 tommmied joined ##javaee
18:49 sess well it's a newly created instance
18:49 sess its already null
18:49 sess unless you create one in its constructor
18:50 Quest if it was already null, why lazy init error then? iam have confused again :)
18:52 sess because you are putting objects from hibernate
18:52 sess in it
18:52 sess you can only get lazy init after that
18:52 Quest oh
18:52 sess boxService.setParent(box, parentBox);
18:52 sess jackson starts making json of box
18:52 sess finds parentbox
18:52 sess traverses it
18:52 Quest once i touched the new object by some service/hibernate method. its then an attached entity
18:52 sess find uninitialized collection
18:52 sess bam, exception
18:52 sess no
18:53 sess nothing is attached in the controller
18:53 Quest got it
18:53 sess if by attached you mean managed
18:53 Quest managed. yes
18:53 Quest but i got your point
18:53 sess it stops being managed when you leave the service
18:53 sess if it was managed, lazy loading would work :)
18:53 Quest oh
18:54 Quest so jackson scans all the code
18:54 Quest in the controller method
18:54 Quest <sess> boxService.setParent(box, parentBox);
18:54 Quest <sess> jackson starts making json of box
18:55 sess no
18:55 sess jackson scans all fields in b
18:56 sess in this case, most of your data is thrown away since you return your VO instead
18:56 sess with only ID and title populated
18:56 Quest but if one field is null and its a list. why jackson makes problem
18:56 sess in this case it shouldnt
18:57 sess since b is not an entity even
18:57 Quest ya this case works fine
18:57 Quest but iam in context to the error case
18:58 sess i dont have the code for the error case
18:58 Quest this one http://pastebin.ca/2464167
19:01 kobain joined ##javaee
19:01 sess as we saw before, setting null doesn't remove the initialization error
19:02 Quest why so
19:02 sess its complicated
19:02 sess its controlled by the parent of the collection
19:02 sess rather than the collection
19:02 sess so the value of the collection doesnt matter
19:02 scripty joined ##javaee
19:02 Quest you said because jackson is looking at the entity. the managed/attached entity. well thats not in controller
19:02 sess anyways
19:03 sess https://github.com/FasterXML/jackson-datatype-hibernate
19:03 sess just get this
19:03 sess and get it over with it
19:03 scripty Hey Quest
19:03 sess it should solve your problem perfectly
19:03 Quest sess,  just conceptulizing.
19:03 Quest sess,  ok.
19:03 Quest scripty,  hi
19:03 Quest sess,  real big thanks for a lot of your time!
19:04 sess cp
19:04 Quest cp?
19:04 scripty My have started java recently completed app in node.js
19:04 scripty I*
19:04 Quest scripty, ok.
19:05 Quest thats nice
19:05 scripty Yes
19:05 Quest sess,  this also works fine. Boxes boxToBeReturned = new Boxes();
19:05 Quest boxToBeReturned.setTitle(savedBox.getTitle());
19:05 scripty Updated my Git ;)
19:05 Quest hm..
19:06 Quest sess,  now the only choice i have to make is either do all that in controller or make some recursive method in service class or use hibernate.getLazyInit
19:06 Quest sess,  or ofcourse the utility you refered
19:10 Quest scripty,  are you selling your app
19:11 Quest i mean making any kind of money?
19:11 scripty no i do only open source
19:11 Quest whats it about?
19:12 scripty video chat real time app
19:12 Quest which requires no middle server?
19:12 Quest correct?
19:12 scripty middle server ?
19:13 scripty It requires a server
19:13 Quest client 1 - server - client 2
19:13 Quest ?
19:13 scripty so i built a server for it and xchat kind client for it
19:13 Quest if 2 people need to chat. would any third machine be involved?
19:14 scripty client 1 - server- client 2
19:15 scripty It works on LAN and WAN
19:16 Quest so you do need a middle server for 2 clients to communicate with each other?
19:16 scripty Yes
19:17 scripty I just built for office use
19:17 Quest why not make the initiating client as client and the other as server.  both would / can have server/client capabilities.       eliminat the need of middle server?      i think your answer would be "problems with nat / firewalls ?"
19:18 scripty huh ?
19:18 scripty firewalls must be taken care by users
19:19 scripty i provide SSL
19:19 Quest ok . so why not just eliminate the need of middle server?
19:19 Quest each client can also act as a server. cant it
19:19 scripty no way
19:20 Quest why
19:20 scripty please explain your theory
19:20 Quest why not make the initiating client as client and the other as server.  both would / can have server/client capabilities.       eliminat the need of middle server?
19:20 scripty i dont want to decentralize
19:20 scripty no way
19:21 Quest ever so called client would be listening for connections in a serversocket and at the same time scanning the network for others clients.
19:22 scripty yea
19:23 Quest so, need of server is gone. isnt it
19:23 Quest so, need of one dedicated  server is gone. isnt it
19:23 Quest no need to route all trafice through one server
19:23 scripty server to centralize things isnt it ?
19:24 MegaMatt How would client 1 know how to find client 2 with out a server to tell it where it lives?
19:24 MegaMatt But after that, DCC is fine by me
19:25 scripty server to centralize after that apply sockets , for example finding client 2 remote ip ; MegaMatt said
19:25 Quest scripty,  yes. if you want to centralize. then server is ok. do you just want all the traffice data to go through server or is there any other purpose of server?
19:26 Quest MegaMatt,   every so called client would be listening for connections in a serversocket and at the same time scanning the network for others clients.
19:26 scripty currently it goes to the server
19:26 MegaMatt Scanning a WAN for other clients is not a good idea, imo
19:27 Quest wan Is an other story
19:27 MegaMatt How about IPv6?
19:27 Quest MegaMatt,  scripty  no. the clients ping the server .   the server cant find clients on wan
19:28 scripty WebSocket is a protocol providing full-duplex communications channels over a single TCP connection
19:28 MegaMatt scripty:
19:28 MegaMatt It works on LAN and WAN
19:28 scripty yes
19:28 MegaMatt Sorry, that was a quote
19:28 scripty you need to set it up
19:28 MegaMatt I'm telling Quest -- having a client that is just scanning the network for servers … yuck.
19:29 MegaMatt Why bother doing that? Why not just have a server who does all the housekeeping for you?
19:29 MegaMatt And then just do Direct Client to Client after that?
19:29 MegaMatt I think that's much cleaner.
19:29 MegaMatt Anyhow
19:29 MegaMatt Not my discussion , and I have other things to do :)
19:30 MegaMatt Let you to have at it again
19:30 MegaMatt *two
19:30 scripty how you will provide SSL security then ?
19:30 MegaMatt What's any of that have to do with lack of or not of SSL?
19:30 MegaMatt you can do SSL from client to server… and from client to client
19:31 Quest MegaMatt,  yes. direct after that is better choice. like skype does for file transfers
19:31 Quest if iam correct
19:31 scripty as of now in server i check ip address , log it , user data
19:31 scripty SSL , all the interaction takes place using socket
19:31 Quest MegaMatt,  but a point is "firewall issues between clients"
19:31 scripty rest all**
19:32 MegaMatt Firewall between the clients is an issue even in client -> server -> client ;)
19:32 MegaMatt But since both clients would know their network config in connecting to server
19:32 MegaMatt You can figure out the best way to do the client to client
19:34 MegaMatt anyhow.. :) .. afk
19:34 Quest MegaMatt,  how skkype solves it then when skype makes direct link between 2 clients?
19:35 scripty ~java
19:37 MegaMatt Quest: or IRC when doing a /dcc ;)
19:38 MegaMatt the nice thing about having a server in the middles is that .. as client1 I don't have to ever tell client2 my IP .. I can stay hidden
19:38 MegaMatt If I don't know/trust you, I might want to keep my IP away from you - and only show it to the trusted server guy :)
19:39 scripty more of security
19:39 Quest MegaMatt,  yes. but in dcc in irc and file transfer on skype. ip is knows
19:39 scripty but in my app you can use whois :D
19:39 Quest known
19:42 MegaMatt A server can always lie about whois information ;)
19:42 MegaMatt But yes, DCC is how you find the truth ;)
19:42 MegaMatt So there's always a trade-off
19:43 MegaMatt It's up to you to make the best decisions for your situation/environment/etc
19:43 MegaMatt Now I'm really AFK :)
19:43 scripty whois is a lie if you mask it or implemented to lie ;)
19:44 Quest how skype eliminates the firewall isue
19:45 scripty like a trusted user ?
20:10 Quest no. i meant while 2 users transfer files
20:10 Quest they get direct with each other that moment. if there are firewalls in the middle. that would be problematic
20:31 scripty I dont believe they get a direct connection
20:31 scripty its thru server
20:32 scripty i gave def above about soc
20:36 tjsnell skype uses hole punching
20:36 tjsnell http://www.h-online.com/security/features/How-Skype-Co-get-round-firewalls-747197.html
20:37 Faux I meant to learn how STUN works properly at some point.
20:42 pdurbin whartung: still fighting shib. day 2: http://irclog.perlgeek.de/shibboleth/2013-10-08 :)
20:43 whartung yay
20:43 MegaMatt pdurbin - you use shib and openAM?
20:44 pdurbin MegaMatt: I tried OpenAM a bit but you have to remove packages from glassfish, which weirds me out
20:45 MegaMatt Ahhh.. I think you posted that on the OpenAM alias, didn't you?
20:45 MegaMatt Try TomCat :)
20:45 * pdurbin sighs
20:45 pdurbin MegaMatt: from a high level, this is what I'm up to: https://lists.iq.harvard.edu/pipermail/dvn-auth/2013-September/000000.html and https://lists.iq.harvard.edu/pipermail/dvn-auth/2013-October/000001.html :)
20:46 MegaMatt Ah cool
20:54 whartung he's been fighting this for about 20 years now MegaMatt
20:55 MegaMatt :)
20:57 whartung Shiboleth was a great motivator in why we wrote our own IdP
20:57 MegaMatt .. You wrote your own IdP???
20:57 whartung yup
20:58 whartung It's actually pretty cool, if I do say so myself
20:58 MegaMatt Too many protocols to support ;)
20:58 whartung meh, hardly.
20:59 whartung HTTP and some SAML
20:59 sfisque IdP … id provider?
20:59 whartung Identity Provider -- term of art in the SAML spaec
21:00 whartung space
21:00 MegaMatt What about OAUTH and OpenID?
21:00 whartung SAML is like French -- they have a different word for everything
21:00 sfisque wasnt oauth defeated last year?
21:00 whartung we don't support OAuth or OpenID
21:01 whartung THere's a curious issue with OAuth folks don't necessarily think through
21:01 whartung (dunno about OpenID, I haven;t looked at it)
21:01 whartung but, as with any hash based system
21:01 whartung you have to store password in plaintext for them to work (or have access to them in PT)
21:02 whartung which is sucky
21:02 MegaMatt mm
21:03 MegaMatt Just looking at all the (weird) stuff you can do with OpenAM .. means that I'm in awe of anyone who'd want to write their own IdP ;)
21:04 whartung but our IdP support SAML 2.0 Web Profile, for both SSO and SLO, support Two Factor Authentication, has user provisioning and replication to client apps (through a non-standard protocol as there really isn't one for this), user activity tracking, you can log out a user from the entire site at the console, see what apps they're using, user templates, role mapping..,
21:04 MegaMatt nice
21:05 whartung but, let me tell you, this stuff is all so fiddly
21:05 whartung so many moving parts
21:05 whartung we also have an adhoc 3rd party token facility (sort of like what OAuth does)
21:05 MegaMatt CDSSO is a bit of black magic imo ;)
21:06 whartung CDSSO?
21:06 MegaMatt Cross Domain Single Sign-on
21:06 whartung nah, it's simple
21:06 MegaMatt with all that token passing and crap
21:07 whartung ha, my answer is the first hit on Google /flex
21:07 whartung http://stackoverflow.com/questions/342378/cross-domain-login-how-to-login-a-user-automatically-when-transferred-from-one
21:07 whartung SAML Web 2.0 is more black magic, however
21:08 MegaMatt heh
21:08 whartung most of the implementations rely on a self submitting form via JS to do the work
21:10 whartung But SAML Web Profile is pretty nice, you can do some neat stuff with it. We've done some cool use cases with it.
21:18 pdurbin keep up the SAML chatter! biked home. off to pick up the kids :)
21:20 MegaMatt Heh
21:20 MegaMatt Well, I'll admit - I'm newb to all this stuff … trying to pick it up and learn it
21:21 MegaMatt In your opinion, what's the big deal about REST .. any ways?
21:25 cem_ joined ##javaee
22:01 pdurbin_m joined ##javaee
22:02 pdurbin_m MegaMatt: rest is better than soap
22:02 pdurbin_m whartung: not quite 20 years. Nice answer
22:03 quesa joined ##javaee
22:03 quesa hi
22:04 pdurbin_m quesa: hey
22:12 kobain_ joined ##javaee

| Channels | #javaee index | Today | | Search | Google Search | Plain-Text | plain, newest first | summary

Please see http://irclog.greptilian.com/javaee for which days have been logged.