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

Justin Chi

+ Follow
since Sep 09, 2009
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Justin Chi

Hi Garry,

Please post your web.xml then we will know why your deployment failed, your error has nothing to do with JAX-RS.

BTW I have something here for you as a ref.


10 years ago

Jaikiran Pai wrote:

I am using JBoss AS 6 Final, but I can not find jars for RestEasy in JBoss installed folder

It's in JBOSS_HOME/server/<servername>/deployers/resteasy.deployer folder.

Thank you J. P , do not realize that it is distributed as in deployer.
11 years ago
Hi all, is telling that Apache CXF implemented JAX-RS will not be included in JBossWS and it is suggested to use RestEasy. Chapter 3 : Installation/Configuration is saying that for JBoss AS 6-M4 or higher , RestEasy is already bundled and integrated completely.

I am using JBoss AS 6 Final, but I can not find jars for RestEasy in JBoss installed folder, should I manully download and add to JBoss?

Or there is something I missed out ?

And what implementation you guys are using for RESTful web service in JBoss AS 6 Final?

Thanks for your comments in advance.


Justin Chi
11 years ago

Paul Sturrock wrote:That will only work on databases that support select ...for update. There is also a flaw in your logic: how do you recover when the process that set the current_user field dies before it set it back to null?

Instead, since this is JPA, you should set the lock mode to be pessimistic.

Hi Paul,

Thanks for your comments.

1. If lock applied at JPA level how transaction will be controlled ? It will start from when pages are loaded and after user confirms the changes ?
2. How another user will know some records already be locked by JPA ? By trying to update and get a returned error?
3. "set the current_user field dies" , if there is any fatal error application should catch it and reset the flag otherwise they need production support team.
4. I understand that pessimistic locking ensures that transactions do not update the same entity at the same time, which can simplify application code, but it limits concurrent access to the data which can cause bad scalability and may cause deadlocks.

1. add a column named "current_user" to table that is going to be updated
2. use "select for update" statement to lock the records whose curernt_user is empty and is going to be updated by user (101), then update those records' current_user colun with user id (101) and release the lock
3. another user (102) comes and see that there is a value in current_user column , this means someone is changing this records , so edit function is disable.
4. after user (101) modifying the records , empty current_user value
5. then user (102) come again, repeat step 2.

If 101 and 102 try to get lock of a record in the same time , one will be failed.
By doing this, only updating of current_user requires a lock in DB, hope it's clear enough.
In the code , you are saving 2 objects in the same time , how child suppose to know id of parent which will be dynamically generated?

It properly should be done in a way that save parent first then get its id and set this id as child's foreign key.
It 's just a same mistake as yesterday : Unable to insert Data using SP from hibernate

You have to give 5 input parameters "?" and you could decide yourself which values would be used in your stored procedure or function.
There are 5 attributes: empid,empName,ecreatedby,empsal and empcate, but you only have 4 "?" as input parameters.
1. Add below to your configuration file:
<property name="" value="create"/>

2. Create a file named "import.sql" and put it in class path, add your inserts into "import.sql". Hibernate will load it automaticly.
Thanks, Paul . and yes , you are right about what Flex compiler does.

But maven plugin has discarded "locale" parameter and replacement is "locales".

Below is the maven output with -X , seems not very useful.

11 years ago
If Hibernate does not left join Electronics, what will happen if you do a session.delete(product) ?

This is how Hibernate works, please note that lazy loading does not work here.

As Electronics object is selected, all it's properties will be in select clause including the ones inherited from its parent and its own attributes like category.

Use plain SQL instead of HQL if you want a clean Product.
Hi all,

I have probelms applying locales features to flex application.

I am using maven flex plugin to build my application like "mvn flex:makeswf -Dlocales=fr_FR"

But below is the info shown on maven console:
[INFO] Building locale en_US

My POM is here

Maven flex refer :

Please note that it works with en_US , so my folder structure is correct.

Thanks advance for your help.

Justin C
11 years ago
I think you can use Interceptor API , there is a onDelete event you can override to do whatever you like.
I suggest to use Criteria API as below:
To force initialization of a proxy or persistent collection, there are 2 ways I know:
1. Use fetch-join strategy (can be in hbm.xml or java code)
2. User org.hibernate.Hibernate.initialize(object) method

I personally do not like "open session in view" pattern.