Time |
S |
Nick |
Message |
02:18 |
|
|
thisMoment joined ##javaee |
02:21 |
|
thisMoment |
Anyone here familiar with jms acknowledgment modes? |
02:22 |
|
thisMoment |
What is the purpose of setting the topic session acknowledgment mode? |
02:22 |
|
thisMoment |
for the publisher |
03:05 |
|
|
sfisque joined ##javaee |
03:06 |
|
|
sfisque1 joined ##javaee |
04:46 |
|
|
dangertools joined ##javaee |
04:54 |
|
|
jaya_ joined ##javaee |
05:58 |
|
|
manulite joined ##javaee |
07:18 |
|
|
jaya_ joined ##javaee |
07:38 |
|
|
jaya_ joined ##javaee |
08:18 |
|
|
jaya_ joined ##javaee |
08:30 |
|
|
neuro_sys joined ##javaee |
08:34 |
|
|
jaya_ left ##javaee |
08:47 |
|
|
joshua_j_ joined ##javaee |
08:59 |
|
neuro_sys |
anyone used jax-rs for uploading multipart/form-data ? |
08:59 |
|
neuro_sys |
apparently the default implementation that comes with java ee 6 doesn't support multipart/form-data, is that the case? |
10:11 |
|
|
dslolz joined ##javaee |
11:15 |
|
|
joshua_jandyco joined ##javaee |
12:03 |
|
|
Quest joined ##javaee |
12:04 |
|
Quest |
neuro_sys, I have used multip part thing but if i remember correctly. you need apache commons or io thing. |
12:05 |
|
Quest |
neuro_sys, these kind of things. import org.apache.http.entity.mime.MultipartEntity; |
12:07 |
|
Quest |
neuro_sys, heres a paste that might help you . but its not jax rs / ws. http://pastebin.com/PVYbD0uM |
12:23 |
|
Quest |
whartung, sfisque1 you were saying yesterday to make the DAO check if user already exists or not in the saveOrUpdate(). when the DAO checks it and a user exists. how would the controller know that "this user already exists" unless DAO also return the same RESULT object as discussed before. (but it was not advised that DAOs use / return Result object.) |
12:29 |
|
Quest |
should the service check for "if user already exists" or the DAO? |
12:30 |
|
neuro_sys |
Quest: thanks, I fixed it having to use jersey jax-rs implementation and its multipart extension. |
12:31 |
|
Quest |
thats even better as you needed jersey |
13:22 |
|
|
Naros joined ##javaee |
13:36 |
|
|
neuro_sys joined ##javaee |
13:48 |
|
Quest |
Naros, you were saying yesterday to make the DAO check if user already exists or not in the saveOrUpdate(). when the DAO checks it and a user exists. how would the controller know that "this user already exists" unless DAO also return the same RESULT object as discussed before. (but it was not advised that DAOs use / return Result object.) |
13:48 |
|
Quest |
<Quest> should the service check for "if user already exists" or the DAO? |
13:48 |
|
Quest |
I would prefer all that in service |
13:48 |
|
Quest |
^respont only if you are free. iam not in a hurry |
13:49 |
|
Naros |
I would suspect since your code looks up users by their email address, the field you store email address probably has a unique index on it or should. |
13:50 |
|
Naros |
so inserting a new user with the same email as an existing user should throw some UniqueIndexException or something similar from the DAO level. |
13:50 |
|
Quest |
emails are unique. an ids are PKs |
13:50 |
|
Naros |
In your service, you'd wrap your code to catch that UniqueIndexException or w/e it's called |
13:50 |
|
Quest |
how about i just check in service method that, 1. if user exists by that email. put fail message in Result object. else save user/ |
13:51 |
|
Naros |
you can but remember, it may be possible that two users try to create an account with the same email addy at once. |
13:51 |
|
Naros |
the first succeeds, the second may check the database and not see the new record yet but upon insert, it fails. |
13:52 |
|
Naros |
so your service should be fault tolerant to support check before but in case of database exception, handle that too. |
13:53 |
|
|
SoniEx joined ##javaee |
13:54 |
|
Naros |
it's a similar concept when you talk about updates to records and OptimisticLockException or pessimistic read/write exceptions. |
13:54 |
|
Naros |
you can validate things to your heart's content but until the transaction happens, anything can happen between those two points in time. |
13:55 |
|
Naros |
on different note, just read about Intel's new I7-4960X cpu. I'm curious of its overall difference compared to my i7-920 |
13:58 |
|
Naros |
hrm, definitely faster plus more cache. |
13:58 |
|
Naros |
12 c/t vs 8 c/t |
13:58 |
|
Quest |
hm |
13:59 |
|
Quest |
i think service methods do things in ONE GO. so 2 users registering with same email wont hurt? |
14:00 |
|
Quest |
Naros, so what is your final vote? |
14:00 |
|
|
tangatools joined ##javaee |
14:00 |
|
|
Naros_ joined ##javaee |
14:00 |
|
|
tangatools joined ##javaee |
14:01 |
|
Quest |
Naros_, you were disconected? |
14:01 |
|
Naros_ |
yah sorry |
14:01 |
|
Quest |
np |
14:01 |
|
Naros_ |
last i saw was "[08:59] <Quest> hm" |
14:01 |
|
Quest |
<Quest> hm |
14:01 |
|
Quest |
<Quest> i think service methods do things in ONE GO. so 2 users registering with same email wont hurt? |
14:01 |
|
Quest |
<Quest> Naros, so what is your final vote? |
14:02 |
|
Naros_ |
your webapp server is multi-threaded or perhaps the webapp is deployed into a cluster of webapp servers. |
14:02 |
|
Quest |
how things SHOULD be done regardless of these matters anyway |
14:02 |
|
Naros_ |
therefore that service method can be ran multiple times |
14:03 |
|
Naros_ |
all at the same precise moment in time. |
14:03 |
|
Naros_ |
database atomic locks keep the data integrity in check naturally, but the webapp can get a db exception at the time of insert due to constraint violations |
14:04 |
|
Quest |
hm |
14:04 |
|
Quest |
Naros, so whats the final say? |
14:05 |
|
Naros |
At the end of the day, you should validate the data but the service should be prepared to handle database exceptions thrown due to concurrent operations or constraint violations or other database unexpected errors. |
14:05 |
|
Naros |
you catch those exceptions in the service, turn them into some meaningful representation you put into that Result object. |
14:07 |
|
Quest |
hm got it. but my question is still there. should some DAO method checkIfEmailExists() be called inside the DAO save(); or both DAO methods be called inside SERVICE methods |
14:07 |
|
Quest |
i would want to go with the later |
14:07 |
|
Quest |
what do you think |
14:07 |
|
Naros |
e.g. during registration, when they save their account, if the email happens to get used by another session before the current session's data is written to the database, catch the UniqueConstraintException, result.setError("emailAddress", "Already in use."); |
14:09 |
|
Naros |
ah; no service calls try { if(dao.isEmailAddressAvailable(emailAddress)) { dao.upsert(..); } else { /* handle email already in use */ } } catch(...) { /* handle db exceptions */ } |
14:09 |
|
Naros |
the reason you want to do it this way is that perhaps you might want to use that isEmailAddressAvailable() in other code blocks too |
14:09 |
|
Naros |
embedding that check solely inside save() means you've encapsulated it away :P |
14:10 |
|
sfisque |
you might want to decouple the test for uniqueness so that later on, you can call down into it from an ajax call to your controller without having to go through a full commit phase |
14:10 |
|
Naros |
plus imo DAO methods shouldn't do validations |
14:10 |
|
Naros |
DAO methods should simply wrap a SELECT, INSERT, UPDATE, or DELETE SQL call |
14:11 |
|
Naros |
doesn't mean there aren't corner cases but those are rare :P |
14:11 |
|
Quest |
hm. |
14:11 |
|
Quest |
brb in 10. |
14:12 |
|
Naros |
Quest: just always follow the notion that services handle business rules & logic, DAO are just interactions with the DB (hence select, insert, update, delete calls). |
14:12 |
|
Naros |
that's the entire premise behind a multi-tiered architecture anyway.... separation of concerns and single responsibility principals play great here. |
14:28 |
|
sfisque |
aye. the dao method to "validate" uniqueness can be a simple method that just queries if an email already exists, no need to fetch, just return count() or exists(). the controller or service can decide what to do with the answer |
14:39 |
|
Naros |
sfisque: you mentioned a DSL concept yesterday for search forms. |
14:39 |
|
Naros |
for example, i have a form where the user has a series of various fields that depending on what they enter, the DAO constructs a HQL query dynamically. |
14:40 |
|
Naros |
im just curious if i can come up with a more elegant way to do that rather than a plethora of if() type checks inside my DAO to construct this HQL |
14:40 |
|
Naros |
stuff like this make me just want to expose the EM and let the service do it :P |
14:40 |
|
Naros |
but that's just bad |
14:41 |
|
Quest |
Naros, so both DAO methods be called inside SERVICE methods rather some DAO method checkIfEmailExists() be called inside the DAO save(); ? |
14:41 |
|
Naros |
otherwise I either create some context object with all the values to pass to the DAO or have an extremely long method signature. |
14:41 |
|
Naros |
i found a generic search framework online where someone abstracts a search api they use in the service to pass to the DAO but not sure if that's ideal |
14:42 |
|
Naros |
search.addFilter("fieldA", value); |
14:42 |
|
Naros |
Quest: Yes. |
14:42 |
|
Quest |
great |
14:42 |
|
Quest |
and by the way. what is upsert ? :) i was only famiilier with insert |
14:43 |
|
Naros |
Remember your service methods are your transaction boundaries. So it makes sense to break up that sorta DAO stuff into multiple methods and chain them together inside the business logic of the service method :). |
14:43 |
|
Quest |
hm |
14:43 |
|
Naros |
lol upsert = update + insert |
14:43 |
|
Quest |
:) |
14:59 |
|
sfisque |
naros: basically you would look at the requirements, cull out the subset of functionality that gives the user what they need (what joins they need, what operations they need). then you can either model those as a "simplified api" (basically an inner platform, but used properly rather than as an anti-pattern) OR you can draft a "little language" that encompasses that "reduced query language" and let the user craft "query scriptl |
14:59 |
|
sfisque |
the DSL would be the latter form |
15:00 |
|
sfisque |
the DSL gives you some future proofing because they can essentially build any query the langauge supports, at the cost of a small bit of training footprint |
15:01 |
|
sfisque |
the "modeled querying" is more user friendly, but your constructs are compile time constrained to a large extent outside of the little bits of "runtime binding" |
15:02 |
|
Naros |
Aye, I believe right now the modeled concept fits mainly because we dont want to expose true adhoc querying yet |
15:02 |
|
Naros |
not sure they ever will want that for this app |
15:03 |
|
sfisque |
aye. another deciding factor is the sophistication of the users. if they're "data jockeys", you don't really want them scripting, unless they actively ask for it and are willing to swallow the training footprint |
15:04 |
|
Naros |
https://code.google.com/p/hibernate-generic-dao/source/browse/ |
15:04 |
|
sfisque |
personally i like query boxes (like jira has) because forms with a bajillion input widgets are just unacceptable UX imo |
15:04 |
|
Naros |
if you traverse to search trunk you'll see what i was referring to earlier. |
15:05 |
|
Naros |
aye, while I concur unfortunately management disagrees given the quality of the userbase |
15:05 |
|
Naros |
these are people who may barely have a HS education. |
15:05 |
|
Naros |
factory/mill workers basically. |
15:06 |
|
sfisque |
right, so you want to give them something constrained and focused. a scripting box would be unapproachable |
15:06 |
|
Naros |
Aye probably less than 5% of the users would like such a UI |
15:07 |
|
Naros |
that may be appropriate for reports tho for management |
15:07 |
|
sfisque |
right, and there you have users who are "more sophisticated"… the proverbial power user |
15:07 |
|
Naros |
yerp |
15:07 |
|
whartung |
That's where you have the "regular" search screen, and then an advanced search screen |
15:08 |
|
Naros |
lol yah |
15:08 |
|
sfisque |
i would go even futher and say the page is constructed by some perm/role decision. give the power users the power screen automatically and vice-versa |
15:08 |
|
whartung |
what we have is a simple "search" field that goes to a routine that "knows" the most common fields (ID, last name, etc.) |
15:08 |
|
sfisque |
have a personal preference to override |
15:08 |
|
whartung |
just search them both |
15:08 |
|
whartung |
then an advanced screen with lots of options |
15:08 |
|
Naros |
sfisque: yep already in the works. |
15:09 |
|
sfisque |
aye, which ever facility you went with, would ultimately go through the same code. one would have a "translation phase" the other would go straight in |
15:09 |
|
Naros |
im just looking at trying to make the backend clean and ideal for future expansion. |
15:09 |
|
sfisque |
i would say, model what the user needs, and have a facility that translates directly to JPA critieria queries |
15:09 |
|
sfisque |
JPA is already a good abstraction layer |
15:09 |
|
sfisque |
no need for more |
15:10 |
|
whartung |
yea |
15:10 |
|
whartung |
we use the EclipseLink criteria API, mostly because JPA2 wasn't out when we started. I like ELs better than JPAs anyway |
15:10 |
|
sfisque |
i'm in the process of ripping out an inner platform in our product because someone in the past "didn't like jpa". really? really? really? gah! |
15:10 |
|
Naros |
hehe |
15:11 |
|
Naros |
I don't mind JPA but putting JPA into my services feels bad. |
15:11 |
|
Naros |
so trying to find a way to validate stuff in services, pass to dao and invoke jpa there. |
15:11 |
|
sfisque |
that's where it belongs. that's why it was invented |
15:11 |
|
whartung |
I accept JPA, I don't necesarily like it |
15:11 |
|
whartung |
I wish it was easier to interoperatate with raw sql |
15:11 |
|
Naros |
So you advocate no DAO then? |
15:11 |
|
sfisque |
its the very reason EM is injectable in EJB. it's why EJB's are transactional |
15:12 |
|
sfisque |
with the advent of EJB3 + JPA, the DAO model is obsoleted if you're in a full EE container |
15:12 |
|
sfisque |
if you're in something like tomcat, dao is pretty much a necessity |
15:12 |
|
Naros |
Well I can inject the EM into my services with ease and use it from there. |
15:12 |
|
|
dangertools joined ##javaee |
15:12 |
|
|
dangertools joined ##javaee |
15:13 |
|
sfisque |
i'm assuming by "service" you mean EJB, or are these managed bean/cdi beans? |
15:13 |
|
Naros |
managed @Service beans by Spring. |
15:13 |
|
sfisque |
ah, so spring's equivalent of EJB |
15:13 |
|
sfisque |
so yes |
15:13 |
|
Naros |
Pretty much. |
15:14 |
|
sfisque |
but spring for the most part exists because of tomcat/jrun/etc. if you're in an EE container, spring is mostly pointless unless you're leveraging some add-on (I/O, batch, etc.) |
15:14 |
|
|
kobain joined ##javaee |
15:14 |
|
Naros |
Understood. |
15:14 |
|
sfisque |
which if you're in tomcat, you don't have JPA or abstraction, so DAO is your abstraction |
15:15 |
|
sfisque |
** or similar |
15:15 |
|
whartung |
well, it doesn't come with the container -- you can use JPA within tomcat standalonew |
15:15 |
|
Naros |
That would probably remove a lot of code bloat and redundancy |
15:15 |
|
Quest |
Naros, you said. result.setError("emailAddress", "Already in use."); so its a messageList that is a hashmap? |
15:15 |
|
sfisque |
you "can" but tomcat has no transactional context, you have to do lots of wiring up or BMT |
15:16 |
|
sfisque |
but yes, you can even use JPA in an SE app |
15:16 |
|
Naros |
sfisque: with spring, just annotate the service method for transactional context |
15:16 |
|
sfisque |
aye. hence why i indicated that spring service == ee ejb |
15:16 |
|
whartung |
but you have to do the same thing for any DB fun in tomcat, so that's not an extra burden for JPA |
15:17 |
|
Naros |
Quest: I'd make the interface pass multiple errors/messages to the caller mainly because you may have something which isn't considered a hard error and may want to pass multiple alerts back to the front-end imo. |
15:17 |
|
Naros |
it's more user friendly to give them all the errors/problems in 1 go rather than have them resolve one to find another exists after a second submission. |
15:18 |
|
Naros |
sometimes that isn't avoidable, but where possible you should. |
15:18 |
|
sfisque |
keep in mind, though that having them decoupled allows for things like "real time validation" via ajax as the user navigates the form |
15:19 |
|
sfisque |
have Va, Vb, Vc, … and then Vx that assembles several of the other validations, so you can do it both "bulk" as well as "granular" |
15:19 |
|
Naros |
Yep. Granular is great for ajax. Bulk is great for non-JS compatible browsers. |
15:19 |
|
Naros |
or where users disable JS |
15:19 |
|
sfisque |
or endpoints that have no UX (rest, corba, RMI, etc.) |
15:19 |
|
Naros |
yap |
15:20 |
|
Naros |
So my service/ejb basically would hold interactions with the EM (eliminating my dao) and business logic or do you typically separate EJB and biz logic? |
15:21 |
|
sfisque |
depends. if the business logic is non-transactional, you can offload it to a simple pojo/cdi/util/etc. if it needs it's own transaction, then it goes into an EJB |
15:21 |
|
Naros |
k; just wanted to make sure i wasn't mixing concerns by doing that. |
15:22 |
|
sfisque |
ultimately there are two drivers for using an EJB. 1) you need a transaction. 2) you need to cluster (Remote EJB's are cluster aware by spec) |
15:23 |
|
sfisque |
otherwise you can avoid the overhead and go with a simple java bean (pojo/cdi/etc.) |
15:24 |
|
sfisque |
there are other side reasons (convenient access to EE facilities like JMS, JMail, JCA adapters, etc.) |
15:24 |
|
sfisque |
but those first 2 are the biggest drivers to choose/avoid using an EJB |
15:24 |
|
Quest |
Naros, hm. interface. can you elaborate what you mean? |
15:24 |
|
Naros |
By interface I mean, the exposed API that your Result object gives you. |
15:25 |
|
Naros |
allowing Result to return a list or map of things allows you to both return single values in the case of AJAX like sfisque mentioned or bulk values in the case of things like remote web services, etc. |
15:26 |
|
Naros |
sfisque: gotcha. its just a slightly different approach than the original code base that I am rewriting. |
15:27 |
|
Quest |
ya. that was my plan. and i would set each message in the internationalization properties file and also give it a name. so I only enter the name of it in the method and it auto gets the text message from .properties |
15:27 |
|
Naros |
trying to clean things up and move away from tomcat centric things since i want to migrate this to a full EE server in the near future. |
15:27 |
|
whartung |
like what tomcat centric things? |
15:28 |
|
Naros |
mainly considering the removal of spring |
15:29 |
|
whartung |
well it's probably a good start simply porting your app as is to a JEE server, little reason it shouldn't just move right over same perhaps tweaks to context.xml or other tomcat server configurations |
15:29 |
|
Naros |
ok |
15:29 |
|
whartung |
then at least you'll be in the proper environemnt |
15:29 |
|
Naros |
true that. |
15:34 |
|
sfisque |
just keep in mind that spring doesn't play nicely in some environments (i encountered a problem with spring not wanting to use the container JTA provider in websphere 6.1. it was a nightmare) |
15:35 |
|
whartung |
yea but websphere doesn't play nicely with anything or anyone |
15:35 |
|
sfisque |
lolz |
16:04 |
|
|
Naros joined ##javaee |
16:07 |
|
Quest |
sily question. my args list has as LIst. I am tring to give an arg of array. how to handle? |
16:07 |
|
Naros |
you mean method(String[] args) ? |
16:07 |
|
Quest |
method (Lsit mylist) |
16:08 |
|
Naros |
method(new ArrayList()): :P |
16:08 |
|
Naros |
or are you saying you have a Object[] but need to pass a List<> to the method? |
16:08 |
|
Quest |
how to add multiple strings in that arralist in one line? |
16:08 |
|
Quest |
the method is declared as method (Lsit mylist) |
16:09 |
|
Quest |
I need to pass multiple strings . I cant find a generic way |
16:09 |
|
Naros |
List l = new ArrayList<String>(); |
16:09 |
|
Naros |
l.add("1); |
16:09 |
|
Naros |
l.add("2"); |
16:09 |
|
Naros |
method(l ); |
16:09 |
|
Quest |
ya. that I dont want |
16:09 |
|
Quest |
l.add("1); |
16:09 |
|
Quest |
l.add("1); |
16:09 |
|
Quest |
ya. that I dont want |
16:10 |
|
Quest |
I want it to be on one line. possible? |
16:10 |
|
sfisque |
addAll( Arrays.toList( <array ) ); |
16:10 |
|
Naros |
Collections.addAll(list, "1", "2", "3", "4"); |
16:11 |
|
Naros |
think you'll at least be required to have two lines tho :P |
16:11 |
|
Quest |
Arrays.asList(yourarray); will that do? how to add multiple strings in online to that method ^? |
16:11 |
|
Quest |
hm. |
16:12 |
|
Quest |
Arrays.asList("string","string") ? |
16:12 |
|
Naros |
yep |
16:12 |
|
Naros |
http://docs.oracle.com/javase/7/docs/api/java/util/Arrays.html#asList(T...) |
16:12 |
|
sfisque |
Arrays.asList( new Object[] { "string", "string"….. } ); |
16:12 |
|
sfisque |
or …. new String[] { blah blah blah } |
16:13 |
|
sfisque |
you can inline an array creation with new Type[] { … } |
16:13 |
|
Naros |
very true, often forget about that syntax. |
16:14 |
|
Quest |
hm.... |
16:14 |
|
Quest |
whats the most generic |
16:14 |
|
sfisque |
most generic takes several lines, adds in null checking, handles zero size array case, etc. |
16:15 |
|
Quest |
Collections.addAll(list, "1", "2", "3", "4"); or Arrays.asList("string","string") or new String[] { blah blah blah } // <--well this is not a LIst |
16:15 |
|
sfisque |
"blah blah blah" is my catch all "you put whats required here" |
16:15 |
|
sfisque |
aka, don't be lazy :P |
16:15 |
|
Quest |
but thats not List |
16:15 |
|
Quest |
its array |
16:16 |
|
sfisque |
right and you feed that to Arrays.toList() |
16:16 |
|
Naros |
Arrays.asList() converts an array to a list :P |
16:16 |
|
Naros |
er toList rather |
16:16 |
|
sfisque |
which you then feed to addAll() |
16:16 |
|
sfisque |
bascially decorating |
16:16 |
|
sfisque |
you keep decorating until you get what you want |
16:17 |
|
Quest |
hm |
16:17 |
|
Quest |
sfisque, new String[] { blah blah blah } // is your choice then. Naros whast yours ? :) |
16:17 |
|
Naros |
it depends on what I am trying to do |
16:17 |
|
sfisque |
not my choice, unless you REALLY REALLY need it on one line |
16:18 |
|
Naros |
I rarely have a requirement to have stuff like this on one line :P |
16:18 |
|
sfisque |
i'm not a fan of collapsing code when you are skipping things like null checks, type checking, etc |
16:18 |
|
Naros |
It's ok if I am defining something like SPECIAL_CHARACTERS = { 'a', 'b', 'c', 'd' }; |
16:18 |
|
Naros |
which is usually some final declaration in a class somewhere. |
16:18 |
|
sfisque |
aye |
16:18 |
|
* sfisque |
nods with naros |
16:19 |
|
sfisque |
collapsed code tends to be difficult to maintain over time. ultiimately you end up deinterlacing it anyway |
16:20 |
|
Naros |
it can also be hard to decipher at a glance what's going on |
16:20 |
|
sfisque |
that too! |
16:20 |
|
Naros |
reminds me of people who write SQL statements on one lines :/ |
16:20 |
|
Quest |
Naros, hm. just for sharing up with you. http://pastebin.com/pFcuze66 |
16:21 |
|
Quest |
line 40 is a service method |
16:21 |
|
Naros |
imo you're polluting separation of concerns here |
16:21 |
|
Quest |
:| |
16:21 |
|
Quest |
? |
16:22 |
|
Naros |
you have Result translating that error list |
16:22 |
|
Naros |
again I dont know spring's web framework but in struts you'd never do that. |
16:23 |
|
Quest |
ya. so that I just give the service methods the name of error. all will be done auto |
16:23 |
|
Quest |
why not? |
16:23 |
|
Naros |
my action would get the error list, iterate it and call addErrorMessage(getText(resultErrorIterator.next())); |
16:23 |
|
Naros |
because struts has their own error notification framework |
16:24 |
|
Naros |
plus what do you do if you have a situation where you don't need to translate anthing? |
16:24 |
|
Naros |
you want to pass the raw errors to the caller. |
16:25 |
|
Naros |
Result is meant to pass a list of errors, result object and status code. It shouldn't really do much more than that |
16:25 |
|
Naros |
If you want a translated result, perhaps a second class that takes a Result as a constructor arg, does the translation and spits out the translated messages. |
16:26 |
|
sfisque |
aye, have a factory or helper method taht does that translation. pass the Result in, and have it "fix" the result for your later consumption needs |
16:26 |
|
Naros |
I'm just cautioning you to be concerned about SoC and SRP rules is all. |
16:27 |
|
|
dreamreal was kicked by Quest: dreamreal |
16:27 |
|
Naros |
You might not see the benefit now, but 12 months away you'll appreciate it |
16:27 |
|
Naros |
when something comes up that you need to pass those raw errors to the caller :P |
16:27 |
|
|
JAZ1976 joined ##javaee |
16:28 |
|
Naros |
as for the save method |
16:28 |
|
Naros |
i would expect some try/catch blocks in there long-term. |
16:28 |
|
* Quest |
reads what Naros said. |
16:29 |
|
Quest |
Naros, if internationalization is used. there should be no point when raw text should be shown in JSP page. everything should be by .properties |
16:30 |
|
Quest |
longterm planning ^ ? |
16:30 |
|
Naros |
Right but that's the job of the controller or some controller helper object, not Result. |
16:30 |
|
Naros |
Result is just a helper class for getting information from your service tier back into your controller/view tier. |
16:30 |
|
Quest |
I did the fetching in Result class so it gets centralized and i dont have to do that in each service method |
16:31 |
|
Naros |
Create a class called ResultUtil with a translate method |
16:31 |
|
Naros |
pass in Result, have it return you a new result with the errors translated. |
16:32 |
|
Naros |
then in your controllers |
16:32 |
|
Naros |
Result r = service.method(); |
16:32 |
|
Quest |
Naros, yes. the controller will just iterate the List taken from Result object |
16:32 |
|
Naros |
Result translatedResult = ResultUtil.validate( r ); |
16:32 |
|
Naros |
er translate( r ); rather |
16:33 |
|
Naros |
you could just have it return you a List<String> instead. |
16:33 |
|
Quest |
let me see. |
16:33 |
|
Quest |
who returns it? |
16:33 |
|
Naros |
We do similar things in our Password Rule engine code. |
16:35 |
|
Naros |
here's a mock |
16:35 |
|
Naros |
http://pastebin.com/hnstWkmd |
16:35 |
|
Quest |
Naros, you think mine was some what not below average? |
16:35 |
|
Quest |
ok |
16:36 |
|
Naros |
overlook my typo on line 10 |
16:36 |
|
|
jz1976 joined ##javaee |
16:36 |
|
Naros |
I just see the benefit in not having Result translate the errors for long-term maintainability. |
16:36 |
|
Naros |
translation is a UI concept. |
16:36 |
|
Quest |
hm got it |
16:36 |
|
Naros |
what if the controller is part of a web service invoked by some remote system. |
16:37 |
|
Naros |
soap/xml/etc. |
16:37 |
|
Naros |
That's all I am getting at Quest. Yours is fine as it was but it blurs what I would consider separation of conerns. |
16:38 |
|
Naros |
Quest: fixed my typos http://pastebin.com/9QtqfdvK |
16:39 |
|
|
neuro_sys joined ##javaee |
16:43 |
|
Quest |
hm |
16:45 |
|
Quest |
k |
16:48 |
|
Quest |
thanks Naros . |
16:50 |
|
Naros |
yw. |
16:50 |
|
* Naros |
grumbles when myeclipse locks up and must be killed. |
16:50 |
|
* Naros |
sighs. |
17:04 |
|
tjsnell |
eclipse always makes me grumble |
17:49 |
|
|
sirajperson joined ##javaee |
17:51 |
|
sfisque |
i have the opposite reaction tjsnell. eclipse makes me point and laugh :P |
17:51 |
|
sfisque |
JK |
17:51 |
|
sfisque |
but really, it makes me point and laugh... |
17:51 |
|
sfisque |
JK |
17:51 |
|
sfisque |
:P |
18:20 |
|
|
scripty joined ##javaee |
18:21 |
|
scripty |
why there is no proper java channel ? |
18:21 |
|
sfisque |
because all the proper people are in here :P |
18:22 |
|
sfisque |
dunno |
18:26 |
|
Quest |
lol |
18:26 |
|
Quest |
scripty, dont you think ##java and ##javaee are proper java channels? |
18:27 |
|
scripty |
##java requires registration |
18:27 |
|
scripty |
and ##javaee here it's speechless compared to other channel |
18:27 |
|
Quest |
scripty, registering nicks is good. isnt it? and ##java has its reasons to impose that. my be to avoid flooding and problems |
18:28 |
|
Quest |
scripty, ##javaee was born a month ago. so its new channel. you can be a part of it to grow it |
18:28 |
|
sfisque |
we get chatty in here. it comes and goes. |
18:28 |
|
* Quest |
nodes |
18:28 |
|
sfisque |
since we're not "general" like ##java, the discussions tend to be focused |
18:28 |
|
sfisque |
and sometimes get a little comical |
18:29 |
|
* sfisque |
throws a pie at the face of Spring |
18:29 |
|
Quest |
sfisque, i welcome core java questions too but since the name of ##javaee is javaee. so most imply it as only ee |
18:30 |
|
sfisque |
aye, we don't squeltch off topic stuff, as long as it's not disruptive |
18:30 |
|
Quest |
ya :) |
18:30 |
|
scripty |
It must be like java and ee |
18:30 |
|
sfisque |
and pies |
18:30 |
|
sfisque |
:P |
18:31 |
|
Quest |
ya. you can change the topic if you want to |
18:31 |
|
Quest |
channel topic i mean |
18:31 |
|
sfisque |
nah, that removes the element of surprise! |
18:31 |
|
Quest |
:) |
18:31 |
|
|
whartung joined ##javaee |
18:31 |
|
scripty |
If it's like java and ee things would be fine . |
18:31 |
|
Quest |
here comes a surprise |
18:32 |
|
whartung |
I like surprises! |
18:32 |
|
* sfisque |
puts on his best clown costume |
18:32 |
|
whartung |
I mean, you know, not "maniac in hockey mask with a knife in the closet" surprises…but … surprises |
18:32 |
|
sfisque |
ready! |
18:32 |
|
sfisque |
spoil sport |
18:32 |
|
whartung |
Surprises, yes. Trauma, no. |
18:32 |
|
* sfisque |
quickly hides the knife behind his back |
18:32 |
|
|
Topic for ##javaee is now Core Java AND Java Enterprise Edition (Java EE) discussion | logs at http://irclog.greptilian.com/javaee/today |
18:33 |
|
scripty |
Thank You :) |
18:33 |
|
whartung |
"I just wanted to carve a little Z on your forehead..." |
18:33 |
|
|
Topic for ##javaee is now Core Java (Java SE) AND Java Enterprise Edition (Java EE) discussion | logs at http://irclog.greptilian.com/javaee/today |
18:34 |
|
scripty |
This is IRC and ##java should not ask for registration things , or else i'll ask my bot to do the task :D |
18:34 |
|
Quest |
hm.. the channel lacks up a webpage for it. I hope I can make it up if i get the time |
18:35 |
|
whartung |
"registration things"? |
18:35 |
|
Quest |
scripty, you can talk to ops in ##java like tjsnell if you have any issue with ##java . we dont have much influence on it though |
18:37 |
|
tjsnell |
it's not unreasonable to require registered nicks |
18:37 |
|
tjsnell |
prevents a lot of unwanted attacks etc |
18:37 |
|
scripty |
Its so uncommon |
18:37 |
|
* Quest |
agrees with tjsnell (specially for large channels) |
18:37 |
|
tjsnell |
that said, I have no influence over the matter |
18:38 |
|
tjsnell |
what's the problem with registering? |
18:38 |
|
Quest |
but large channels like #ubuntu or #debian do contrary |
18:38 |
|
scripty |
Have u gone through #haskell channel |
18:38 |
|
Quest |
tjsnell, arnt you an oper in ##java? |
18:38 |
|
tjsnell |
I am |
18:38 |
|
tjsnell |
but it's not my channel |
18:38 |
|
tjsnell |
I have no say in how it's run |
18:38 |
|
Quest |
then how come you have no influence |
18:38 |
|
Quest |
oh |
18:38 |
|
Quest |
ok |
18:38 |
|
Quest |
cheeser then. |
18:39 |
|
tjsnell |
I'm an op at the whims of the channel owner |
18:39 |
|
tjsnell |
just like every op here |
18:39 |
|
Quest |
tjsnell, things are different here... |
18:39 |
|
sfisque |
yah, we execute the unbelievers at dawn |
18:39 |
|
sfisque |
the streets will flow with blood!!! blood!!!! |
18:39 |
|
tjsnell |
but the ops here are subject to the whims and good graces of the owner |
18:39 |
|
tjsnell |
period |
18:40 |
|
sfisque |
that too |
18:40 |
|
Quest |
i can make Naros or whartung or sfisque as channel founders/owners anytime they want. I see it that way that we all own the channel. |
18:40 |
|
tjsnell |
different rules may apply here but that's because that's what the channel owner has decided is OK |
18:40 |
|
tjsnell |
then do so |
18:40 |
|
tjsnell |
all talk before then |
18:41 |
|
scripty |
Wow! |
18:41 |
|
tjsnell |
benevolent dictator with one owner |
18:41 |
|
tjsnell |
which I'm fine with but don't pretend it's otherwise :) |
18:41 |
|
Quest |
tjsnell, sure. if hey ask . i would. whats the problem? there are already 3 owners. (none afraid of a take over :)) |
18:41 |
|
tjsnell |
I don't have a problem |
18:42 |
|
Quest |
ok. nevermind. I know they wont ask. because. it doesnt matters........... |
18:42 |
|
Quest |
period. lets talk about java and ee from now :) |
18:42 |
|
* Quest |
be right back. |
18:42 |
|
tjsnell |
see, dictating! |
18:43 |
|
Quest |
oh. yes. the respect for them in my heart is what matters I think. |
18:43 |
|
* tjsnell |
gags |
18:43 |
|
scripty |
Its not dictating , just an opinion IMV |
18:43 |
|
tjsnell |
really? |
18:43 |
|
Quest |
scripty, ya. unfortunately tjsnell has a different mind set..... |
18:43 |
|
tjsnell |
I'll shutup before the dictators ban me |
18:44 |
|
Quest |
tjsnell, be cool. |
18:44 |
|
tjsnell |
I am |
18:44 |
|
Quest |
take it easy :) |
18:44 |
|
tjsnell |
yes sir |
18:44 |
|
Quest |
lol. |
18:46 |
|
Quest |
tjsnell, I would say one thing now. once. they are my friends. It wont look good to me if any one tries to spit poison in our harts for each other. |
18:46 |
|
|
SoniEx2 joined ##javaee |
18:46 |
|
Quest |
scripty, are you knew to IRC? |
18:47 |
|
scripty |
no |
18:47 |
|
tjsnell |
Yes sir |
18:47 |
|
Quest |
new to freenode? |
18:47 |
|
scripty |
yeah |
18:47 |
|
Quest |
i see. were where you before? |
18:48 |
|
tjsnell |
I'm not sure what I've said that could be construed as trying to foster unrest or spitting poison |
18:48 |
|
Quest |
freenode is the home of tech and opensource |
18:48 |
|
Quest |
tjsnell, no problems dear |
18:48 |
|
scripty |
Quest yes , Some hacking channel |
18:48 |
|
* tjsnell |
hugs you |
18:48 |
|
Quest |
wow. |
18:50 |
|
* sfisque |
feels the love' |
18:50 |
|
* sfisque |
queues up the stereo and breaks out the beer and chips |
18:50 |
|
Quest |
:) |
18:51 |
|
whartung |
\o\ /o/ \o\ /o/ |
18:51 |
|
sfisque |
^_^ |
18:52 |
|
Quest |
whartung, sfisque how about we register a ##javaee-offtopic channel too. (despite we might not need one as such channels are needed for huge over grown channels) ? |
18:53 |
|
sfisque |
overkill atm. this channel is no where near saturation |
18:53 |
|
scripty |
Well , i am scripty , new to java , nice to meet you guys ........ I thought of this was some kind of lame statement :P |
18:53 |
|
Quest |
hm |
18:53 |
|
Quest |
thanks scripty |
18:54 |
|
Quest |
sfisque, ok. for later then. |
18:54 |
|
* sfisque |
nods to Quest |
18:56 |
|
|
scripty joined ##javaee |
18:58 |
|
scripty |
Have anyone used sqlite ? |
18:58 |
|
tjsnell |
lots have |
18:58 |
|
Quest |
In android. i guess yes. |
18:58 |
|
scripty |
scaliblity ? |
18:59 |
|
Quest |
not too much I 'gues' |
18:59 |
|
whartung |
sqlite? Scalability? No. |
18:59 |
|
Quest |
scripty, its light weight... |
18:59 |
|
Quest |
scripty, not heavy hard core thing. |
19:00 |
|
Quest |
scripty, can you tell the use case of it (which you want) |
19:00 |
|
whartung |
it's awesome, don't get me wrong, but not for servers really. |
19:00 |
|
Quest |
why are you using it in the first place |
19:00 |
|
scripty |
I have a requirement where i dont think they will access more then 10 people/week of the website |
19:00 |
|
sfisque |
i have used sqllite (not on android). it's pretty good |
19:00 |
|
sfisque |
it's "as good" as using javadb or hsql |
19:00 |
|
Quest |
scripty, then you are good with it. |
19:00 |
|
whartung |
I'd still use postgres. |
19:01 |
|
sfisque |
mysql |
19:01 |
|
sfisque |
:P |
19:01 |
|
* Quest |
agrees with whartung |
19:01 |
|
scripty |
I like to run the application for 2 months |
19:01 |
|
tjsnell |
10 people/week? any db will be fine |
19:01 |
|
whartung |
postgres is simple to install and works out of the box. |
19:01 |
|
Quest |
ya. |
19:01 |
|
sfisque |
aye, at that scale, you could even use xml files :P |
19:01 |
|
Quest |
ya.. |
19:01 |
|
scripty |
:D |
19:01 |
|
sfisque |
or berkelydb |
19:01 |
|
Quest |
any thing would work with 10 people/week |
19:02 |
|
whartung |
but it's better to get experience with something like postgres. It's a spectacular swiss army knife of data stuff |
19:02 |
|
tjsnell |
berkelydb can handle serious load |
19:02 |
|
sfisque |
oracle 12c enterprise edition :P |
19:02 |
|
Quest |
PG is my fav |
19:02 |
|
sfisque |
i "dislike" postgres. it does somethings in very "unorthodox" ways |
19:02 |
|
whartung |
sqlite is nice where it's embedded. but if you;re not embedding, then postgres. |
19:02 |
|
tjsnell |
mysql does massive things wrong |
19:02 |
|
Quest |
hm. oracles is on the top. dont know why as i never used it |
19:03 |
|
whartung |
like what sfisque |
19:03 |
|
scripty |
postgres is open source oracle |
19:03 |
|
scripty |
:) |
19:03 |
|
tjsnell |
http://grimoire.ca/mysql/choose-something-else |
19:03 |
|
Quest |
tjsnell, mysql has a silly license too. you cant embed it in you app |
19:03 |
|
whartung |
stay away from oracle. It's spectacular, but super complicated |
19:03 |
|
Quest |
and distribute it |
19:03 |
|
Quest |
scripty, ya. i would want to say that too. |
19:03 |
|
Quest |
but oracle is huger than pg i heard |
19:03 |
|
sfisque |
when i used it (7.x) trying to do things like navigating a schema (list tables, FKs, PKs, etc.) was difficult, at best |
19:04 |
|
whartung |
7.x is, like, 1937 time frame sfisque |
19:04 |
|
sfisque |
aye. have they improved that? |
19:04 |
|
whartung |
I dunno. I use their GUI tool. |
19:05 |
|
whartung |
their system table are not for the weak, I admit that |
19:05 |
|
whartung |
but that's what JDBC Metadata is for :) |
19:05 |
|
whartung |
and schema exports |
19:05 |
|
sfisque |
imo, a db's true worth is how easy is it to use from cli. mysql is very easy to admin from cli |
19:05 |
|
whartung |
postgres is pretty easy, I guess. I never do anything to it :) |
19:05 |
|
sfisque |
oracle less so, but you can do EVERYTHING from inside the engine with simple select statements |
19:05 |
|
whartung |
it's one sticking point |
19:05 |
|
whartung |
is the hba.conf file |
19:05 |
|
sfisque |
ugh, it still uses that setup? |
19:06 |
|
whartung |
yea |
19:06 |
|
whartung |
biab |
19:06 |
|
sfisque |
another issue. have they corrected postgres' ability to recover from corruption? |
19:06 |
|
sfisque |
in 7.x if things got corrupted, you were effectively hosed |
19:07 |
|
Quest |
DB2 is also said to be stablest |
19:07 |
|
sfisque |
packing up. ttys |
19:07 |
|
* Quest |
waves |
19:10 |
|
scripty |
if any newcomers here i would like to do some projects with them although i can write ugly code if not bad code :D |
19:12 |
|
* scripty |
pff*** No new comers |
19:19 |
|
scripty |
? |
19:40 |
|
|
sfisque joined ##javaee |
19:44 |
|
|
scripty joined ##javaee |
19:47 |
|
scripty |
How long you guys are working on java ? |
19:49 |
|
sfisque |
~18 years |
19:49 |
|
sfisque |
14 years of EE |
19:49 |
|
scripty |
WOW ! |
19:50 |
|
sfisque |
learned java with the 0.92b compiler :P |
19:51 |
|
scripty |
I started java on 2010 and discontinued on 2012 |
19:51 |
|
scripty |
so no much to say :( |
20:06 |
|
|
Quest joined ##javaee |
20:07 |
|
Quest |
Iam getting nulpointer exception for the following 3 classes. (lines pointed in exception are marked with ##########). any ideas why its making np exceptions>? http://pastebin.com/yxxB4Yjr |
20:14 |
|
Quest |
consider this one http://pastebin.com/WRLFRUDy |
20:16 |
|
Quest |
nevermind ^ |
20:26 |
|
scripty |
I dislike framework although spring touched me ;) |
20:28 |
|
Quest |
its a quicksand |
20:33 |
|
sfisque |
you know if spring touched you, you can report that. |
20:36 |
|
Quest |
http://pastebin.com/WRLFRUDy line 64 . messages is abstract. cant initialize it. any work around? |
20:39 |
|
sfisque |
check the API. there is probably a factory that produces Impl instances |
20:40 |
|
|
scripty_ joined ##javaee |
20:57 |
|
|
Quest joined ##javaee |
20:57 |
|
Quest |
disconnected |
20:58 |
|
Quest |
found interface for messagessource but no use. tried. new paste == http://pastebin.ca/2444607 Iam getting nulpointer exception for the following 3 classes. (lines pointed in exception are marked with ##########). any ideas why its making np exceptions>? |
20:58 |
|
Quest |
<Quest> DAO = http://pastebin.com/5ryeppUy debugs---a , b, d are visible. |
21:11 |
|
Quest |
nevermind ^ |
21:11 |
|
Quest |
found it. http://pastebin.ca/2444620 line 67 of paste only prints out as result class test --------- 1 not 2 or 3. so why messages is null? |
21:20 |
|
Quest |
new paste = http://pastebin.ca/2444623 |
21:38 |
|
Quest |
complete info is at http://stackoverflow.com/questions/18666916/spring-and-messagessource-null-pointer-exception |
21:47 |
|
|
SoniEx2 joined ##javaee |
23:47 |
|
|
SoniEx2 joined ##javaee |
23:50 |
|
|
Quest joined ##javaee |