Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link

Steven Jiang

Greenhorn
+ Follow
since Mar 01, 2008
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Steven Jiang

Really appreciate your detailed reply, I am looking for explanation like this as well.

Will bookmark it.

Thank you.
Steve
11 years ago
Thank you very much for your detailed response. it definitely helps me understand much more.

Appreciate it.
Steven
11 years ago
Anyone can help me with my question as follows.


My question is what is:
wsa:Action="http://example.com/numbers/AddNumbersPortType/Result"
for???

My project use it as well, I searched URL, can not find another reference, only defined in one place.

Thank you
Steven
11 years ago

Eric Pascarello wrote:They should work the same. I do not think I have ever seen anyone write it the 2nd way in production code.

I know if you do not have the () around it, it will cause an error.

Eric



Thanks Eric, I finally found something interesting..
You can get lots of detailed explanation there, so far haven't fully understand them

http://rapd.wordpress.com/2007/12/02/function-constructor-vs-function-declaration-vs-function-expression/

Eric Pascarello wrote:Looks like an error to me on the 2nd one




Sorry man there is typo there

function (){ ....}<---------------0
Hi all

could anyone here tell me the difference between

and


I tested, it seems having the same result which is executing the code inside the function.
Thank you.
Steve

Balu Sadhasivam wrote:
select distinct(name) from File where size!=0

more faster
select distinct(name) from File where size > 0



thanks for that, but your answer is not right, if you run it against the table I created, you will get "a", "b", but "a" is related two records with '0' in size field.

Jane Dodo wrote:
Alternatively: given an object, how do I know whether another object with the same id exists in the database? (but without knowing which fields constitute the object's id?

The only solution I can think of is parsing annotations and using reflection - yikes! There has to be an easier way.



Not sure can answer your question.

can you merge it first, then use session.getIdentifier()?
Hi All

Another query to ask here. we have a table
File(name ,date, file_size).
anyone has simple query to list name of file where the related size is not 0

let me give some sample data.
name date size
a 1/1/2001 0
a 2/1/2002 2
a 3/3/2003 0
b 1/1/2000 3
b 2/2/2001 4

If I run the query, it should list "b" only as "a" has two related size = 0.

I know the sql for it. but seems contain subquery and complex. so I am after a simple HQL

Thanks in advance.

Steven

the sql would be
Hi All

Another sql to ask here. we have a table
File(name ,date, file_size).
anyone has simple query to list name of file where the related size is not 0

let me give some sample data.
name date size
a 1/1/2001 0
a 2/1/2002 2
a 3/3/2003 0
b 1/1/2000 3
b 2/2/2001 4

If I run the query, it should list "b" only as "a" has two related size = 0.

Thanks in advance.

I know a complex query already, just want a simple one.
my query is

Jeanne Boyarsky wrote:Steven,
Why do you have id in the main query? Doesn't that make it distinct? Also, note that you could get more than one record back if there are identical prices.

I would use the code you wrote because it isn't database specific. Another approach is the following. Note that your database needs to support returning only one row and you should check the performance is equivalent through your database explain plan.



Sorry Jeanne, I typed wrong, the first id=? should be userId=?, no wonder I only have your response so far, making people confused

Thanks for your second option, that is a good one if database support it. or use HQL.

Steve
Suppose I have Table Stock (Id, Name, userId, price)

To select a row with highest price given a userId, what the query should be???

I know a way, which I thought a bit complex, anybody here has better idea?

Thanks

My query is:

Manish fico wrote:Steve,
does any of your entities in HQL follow inheritance? If thats the case, hibernate will try to sync the versions of the parent and child even in read operation.
Regards,
Manish



Hi Manish.

Thanks for that, we do have parent abstractbusinessobject as abstract , but not mapped in the mapping file. so I dont think it will have influence on the token increase.

If you think about other clue, please let me know.

Steven

Paul Sturrock wrote:No. Think about it - why would a select statement require optimistic locking?



Thanks again Paul, that did happen, as I can not copy over whole project configure and code, better ask my TL . appreciate your help.

Paul Sturrock wrote:


Anybody know why? I reckon only update a table will trigger an update on the version field, right?


Yes. There is no need to update a version number if all you are doing is selecting the data.



I didn't update the token no manually, I just setup hibernate(copy from my project) and run a simple select query.

Do you know any condition, the select will trigger the updating token field event??

Thanks
Steven