greptilian logo

IRC log for #javaee, 2014-01-20

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
02:42 Bombe joined ##javaee
03:41 fedorstudio joined ##javaee
04:38 mocrunsthecity joined ##javaee
04:46 philbot joined ##javaee
04:46 Topic for ##javaee is now Core Java (Java SE) AND Java Enterprise Edition (Java EE) discussion | ##javaee-offtopic for all kinds of non-tech chat| logs at http://irclog.greptilian.com/javaee/today
10:43 philbot joined ##javaee
10:43 Topic for ##javaee is now Core Java (Java SE) AND Java Enterprise Edition (Java EE) discussion | ##javaee-offtopic for all kinds of non-tech chat| logs at http://irclog.greptilian.com/javaee/today
10:46 javaeebot joined ##javaee
11:08 BooleanByte joined ##javaee
11:32 javaeebot joined ##javaee
12:00 firebird1 i'm usiing Date
12:00 firebird1 no day light saving
12:00 firebird1 no manipulation
12:00 firebird1 safe ?
12:18 alexas joined ##javaee
12:19 rarduin joined ##javaee
12:47 pdurbin joined ##javaee
13:07 weyer joined ##javaee
13:52 tommmied joined ##javaee
14:21 philbot joined ##javaee
14:21 Topic for ##javaee is now Core Java (Java SE) AND Java Enterprise Edition (Java EE) discussion | ##javaee-offtopic for all kinds of non-tech chat| logs at http://irclog.greptilian.com/javaee/today
14:32 Naros joined ##javaee
14:42 kobain joined ##javaee
15:07 fabioportieri http://hackertyper.net/ :>
15:18 firebird1 seriously i'm not jsf flow
15:18 firebird1 i'm sooo difficult jsf :P
15:33 balo joined ##javaee
15:34 firebird1 difference between viewScoped and RequestScoped ?
15:35 fabioportieri http://stackoverflow.com/questions/6025998/difference-between-view-and-request-scope-in-managed-beans
15:37 fabioportieri if you don't need to persist values across http request you should go with requestScoped
16:09 javaeebot` joined ##javaee
16:18 sajjadg joined ##javaee
16:18 syncsys joined ##javaee
16:25 philbot joined ##javaee
16:25 Topic for ##javaee is now Core Java (Java SE) AND Java Enterprise Edition (Java EE) discussion | ##javaee-offtopic for all kinds of non-tech chat| logs at http://irclog.greptilian.com/javaee/today
16:38 neuro_sys joined ##javaee
16:38 neuro_sys joined ##javaee
16:47 sess anyone got experience making a wildcard definition with tiles?
16:47 sess i just keep getting infinite loops..
17:02 whartung I've never used tiles, I just use raw tagfiles
17:07 sess it seems very nifty if i can just get the wildcards to work
17:07 sess so i get free definitions with the same name as the jsp path
17:08 whartung yea, i'm not even sure of the functionality.
17:09 sess it's just an extra layer between the controller and the jsp
17:09 sess that allows for templating
17:09 sess since pure jsp is bullocks
17:11 whartung tag files make tempting trivial
17:11 whartung templating...
17:11 sess it is not possible to do proper templating with tag files
17:11 sess it only allows for composition
17:12 sess you still have to copypaste that include to every single jsp
17:12 sess and <head> is a bitch with jsp:includes
17:13 whartung define "proper templating"
17:50 sfisque i think he means tiles supports proper inheritence.  you can define a decoration or composition as inheriting a parent one, and everything works fine without having to doctor up the inheriting templates/tiles/fragments
17:54 BooleanByte joined ##javaee
17:57 whartung ok
18:16 sess well not the inheritence part per say, but rather that the contet JSPs need not be aware of menus, head parts, footer etc
18:18 sfisque you can do that with "include" in jsp's.   the real power of tiles is you dont have to explicitly re-include everything if you need several "parallel" templates.  just inherit one, and make the small mods
18:21 whartung you can do that with tag files, you just need to wrap the parent tag
18:22 syncsys is there anything wrong with this method? any comments? using spring and hibernate with JPA http://pastie.org/8651314
18:23 syncsys I mean ofcourse, its not good
18:23 whartung method looks fine to me syncsys
18:24 whartung (besides the println before the empty list check...)
18:24 syncsys line 8 and 10 also?
18:24 syncsys ah.
18:25 whartung yea, line 8 has the potential to go boomski
18:26 sess sfisque: not really, include means each jsp has to know all other parts
18:26 sess and explicitly include them
18:26 sfisque i didnt say it did it well.  just that you "could" do it with raw jsp.  tiles makes it more elegant
18:27 sess well or not, it is exactly the opposite of "contet JSPs need not be aware of menus, head parts, footer etc"
18:27 whartung so where does the composition happen in tiles, in a config file?
18:28 sess yeah
18:28 sfisque combination of configuration and design
18:28 sess im upgrading a really old system that uses frames
18:28 sfisque it is similar to how jsf does it
18:28 sess so i slap on tiles, and just remove a few parts from the jsps
18:28 sfisque nice.  frames == t3h debil
18:28 sess that's the theory anyways, if i can get the wildcards to work
18:28 sess because im NOT making definitions for every single jsp
18:29 sess convention over configuration any day
18:29 sfisque well, be careful.  once you start using knockouts " {x}
18:29 syncsys whartung,  how about this (with changed highlighted lines ) http://pastie.org/8651326#2,9-12
18:29 sfisque " for directory fragments, your design can get fragile
18:29 sess knockouts?
18:30 whartung looks fine to my syncsys
18:30 sess syncsys: your last one was better
18:31 sess an exception should be thrown if it's not found
18:31 sess just move the get(0) to after the check
18:31 syncsys added email.tolowercase() http://pastie.org/8651332#1-3,9-13
18:32 syncsys sess,  hm
18:32 sess to make it even snazier
18:32 sess use getSingleReault
18:32 sess throw exception automatically if 0 results
18:32 syncsys sess,  my last one was better? but this one is ok too?
18:32 sess result*
18:32 sess I'd prefer an exception over return null
18:33 sess but both are fine technically
18:33 sfisque and for the love of the baby java, get rid of the system.out.println's.  they are not guaranteed to work in a contained environment.  use a Logger.
18:33 syncsys sess,  sfisque  whartung  one other problem is.  entityManager will never return a null for getResultList()
18:33 sfisque and they're a performance bottleneck.  println is synchronized
18:34 sess syncsys: no it wont, so you wont have to check that either
18:34 sess i dont see how it is a problem
18:34 sess also use a typed query
18:35 sess syncsys: http://pastie.org/8651342
18:35 sess this is fine tbh
18:35 sess catch NoResultException in the calling method
18:35 sess and fail the login there
18:36 sfisque swap the println for LOGGER.info( "blah blah blah" );
18:36 sfisque and define LOGGER at the top of the class
18:36 sfisque private static final Logger LOGGER;
18:37 sfisque well, only final if you instantiate it in place
18:37 sfisque otherwise just static and initialize lazy or aggressive as you see fit
18:38 sfisque if you're working in NB, eclipse, or idea, there's no reason for a println.  you can wire up the debugger and step through the code as desired
18:38 sfisque this isnt 1973
18:58 neuro_sys joined ##javaee
19:11 pdurbin bummer. I used to be able to use curl to POST some JSON to create an object (and persist it to the database) but our object model changed and now I'm getting this: javax.servlet.ServletException: Exception [EclipseLink-44] (Eclipse Persistence Services - 2.5.0.v20130507-3faac2b): org.eclipse.persistence.exc​eptions.DescriptorException Exception Description: Missing class indicator field from database row
19:11 pdurbin [UnmarshalRecordImpl()]. Descriptor: XMLDescriptor(edu.harvard.iq​.dataverse.DvObjectContainer --> [])
19:12 pdurbin anybody know how I can get this working again?
19:13 whartung you using Entity Inheritance pdurbin ?
19:16 pdurbin um. I'm not sure of the details of how the object model changed. I'll hear about it tomorrow
19:17 pdurbin here's my method (newlines removed) that used to work: @POST public String add(Dataset dataset) { datasetService.save(dataset); return "dataset " + dataset.getId() + " created/updated\n;"}
19:17 pdurbin that method takes a Dataset as an argument but in practice I was sending it JSON
19:18 whartung just sounds like that there is some inheritance going on and the classifier column is missing (so JPA can tell what class the row of data really is)
19:18 whartung that's the way I read the error
19:19 pdurbin whartung: yeah, I guess that makes sense... not sure how to fix it though
19:19 whartung add the column and put the correct value in it :)
19:19 pdurbin here's some example JSON I was sending that was working: {"author":"Dr. Bird","citationDate":"2003-​12-11","description":"bird study 1","distributor":"For the Birds","id":"2","owner":{"id":"2"},"title":"bird dataset"}
19:20 whartung what's the schema in the db?
19:23 * pdurbin downloads http://schemaspy.sourceforge.net
19:24 whartung you don't have a sql listener like psql handy?
19:24 pdurbin I have psql. I thought I'd show rather than tell :)
19:25 whartung you're just comparing the columns in the table to the ones in your entity
19:33 pdurbin whartung: I heard you but I haven't been working on the schema. here it is: http://dvn-5.hmdc.harvard.edu/tmp-schemaspy-tmp3/dvn-schemaspy-4861940/
19:37 pdurbin "Exception Description: Missing class indicator field from database row [UnmarshalRecordImpl()]. Descriptor: XMLDescriptor(edu.harvard.iq​.dataverse.DvObjectContainer --> [])" and DvObjectContainer extends DvObject so I guess I should be looking at http://dvn-5.hmdc.harvard.edu/tmp-schemaspy-tmp3/dvn-schemaspy-4861940/tables/dvobject.html
19:39 sfisque pdurbin is there a complementary "read" operation.  read a row of the same data type, and see what columns you're missing
19:42 pdurbin sfisque: yes, actually... and what's new in the JSON hash that's returned is a key called "@type" ... it's the only key with an @ in from of it... the others have no @ such as "title" etc.
19:44 sfisque intriguing.  i've not seen that convention in a java->json object serialization
19:45 sfisque any idea what the @ denotes?
19:46 pdurbin it seems to be the type of the object. so for us... dataverses vs. datasets vs. files
19:46 pdurbin previously I was able to POST all three kinds to create/update and persist them
19:46 pdurbin I'm using moxy in glassfish, as I mentioned here: http://irclog.greptilian.com/javaee/2013-12-05
19:48 pdurbin the @POST method here got me started: https://github.com/javaee-samples/javaee7-samples/blob/master/jaxrs/moxy/src/main/java/org/javaee7/jaxrs/moxy/MyResource.java
19:52 pdurbin whartung: no inheritance going on in that example
20:18 syncsys any one knows why in spring security in CustomUserDetailsService implements UserDetailsService{ it  makes dbUser.getPassword().toLowerCase()?
20:20 syncsys http://krams915.blogspot.com/2010/12/spring-security-mvc-integration_18.html     e.g   line 54
20:35 semiosis syncsys: no, that seems strange to me.  i coerce *usernames* to lowercase, but not passwords
20:35 syncsys i coerce ?
20:35 semiosis username.toLowerCase()
20:35 syncsys ya but line 54 clearly is doing dbUser.getPassword().toLowerCase(),
20:36 syncsys I think it should be to username. not password
20:36 semiosis i agree
20:36 syncsys thanks
20:36 semiosis but you'd have to ask the author of that article, i guess
20:36 syncsys hm
20:51 semiosis pdurbin: sfisque: http://www.w3.org/TR/2014/REC-json-ld-20140116/
20:51 semiosis this is new
20:51 semiosis http://www.w3.org/TR/2014/REC-json-ld-20140116/#typed-values
20:52 semiosis JSON-LD 1.0 - A JSON-based Serialization for Linked Data - W3C Recommendation 16 January 2014
20:52 semiosis 4 days ago
20:52 semiosis sounds related, and the timing is right
20:55 semiosis pdurbin: are you running new code against an existing test/dev database on your machine?  you probably need to update your local db schema
21:10 sfisque ah, so the @…. attributes are "magic" attributes for json.  nifty
21:14 semiosis that's my guess
21:15 semiosis json-ld specifically
21:23 mocrunsthecity joined ##javaee
21:51 tommmied left ##javaee
22:08 pdurbin semiosis: I dropped my old database and started fresh
22:09 semiosis did that fix it?
22:09 pdurbin nope
22:11 weyer joined ##javaee
22:14 pdurbin maybe I need the @XmlAccessorType and/or @XmlType stuff mentioned at http://stackoverflow.com/questions/9875378/descriptorexception-missing-class-indicator-field-from-database-row-exception/9881317#9881317
22:14 pdurbin (even though I'm trying to use JSON rather than XML)
22:15 whartung depending on how you're doing it, JSON and JAXB can be using the same underlying infrastructure.
22:21 pdurbin hmm. ok
22:29 semiosis pdurbin: sounds to me like there's a mismatch between your db schema & your domain entities
22:30 Quest- joined ##javaee
22:30 pdurbin semiosis: but if I drop my db and let all the tables get recreated when I deploy my app... there should be no mismatch, right?
22:30 semiosis what creates them?
22:31 pdurbin magic
22:31 semiosis magic should work
22:31 pdurbin jpa, I guess
22:31 pdurbin I have no idea how this stuff works
22:31 semiosis try those Xml annotations
22:32 semiosis plenty of json stuff uses jaxb
22:32 semiosis as whartung pointed out
22:33 pdurbin trying. many things competing for my attention. as usual
22:49 pdurbin interesting. I'm playing with @type not as a key not at the first level but at the second level (within the "owner") key, and I'm making progress, maybe... a different exception at least: javax.persistence.NonUniqueResultException
22:50 semiosis pdurbin: are you sure you're using the DB you think you're using?
22:51 pdurbin lolz
22:52 pdurbin it's like it's trying to create the owner object... which I don't want to do... I'm trying to specify who the owner is without creating it
22:52 pdurbin since the owner already exists
22:55 semiosis pdurbin: i think you need to pull the existing item from the db via jpa
22:57 pdurbin huh. I got something to work. weird. maybe a bug somewhere else in our code
23:06 pdurbin well... I got something to be persisted... using @type nested inside my JSON, but the resulting object is all broken and weird
23:07 pdurbin here's the JSON I used: {"affiliation":"For the Trees","alias":"chestnuts"​,"contactEmail":"chestnuts@trees.com","description":"chestnuts etc","id":"9","name":"Chestnuts","owner​":{"@type":"dataverse","alias":"tmpAlia​s","name":"tmpName","contactEmail":"tmp@tmp.com","id":"4"}}
23:08 pdurbin anyway, no more DescriptorException... and I never put any of the XML annotations in... so maybe it's just a matter of me figuring out what JSON to feed it to get a proper object persisted
23:32 sfisque yeah, i'd guess they use the same reflection framework and just load a different "de/encoder" for the actual read/write phase
23:49 pdurbin yeah

| 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.