Choon-Chern Lim

Ranch Hand
+ Follow
since Aug 29, 2005
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 Choon-Chern Lim


I'm building a standalone java application using Spring. I created a runnable jar from Eclipse. When I execute this runnable jar using "java -jar c:\test.jar", Spring is not able to find the defined beans.

In my code, I have the following line to load my Spring beans:-



It seems like this code that works fine in the Eclipse environment is no longer valid when running from a jar because Spring is not able to find the XMLs located in the runnable jar.

I inspected the XMLs in the jar and they are located under /resources folder. So, I tried "/resources/app-*.xml" and "resources/app-*.xml", and none worked. I tried plenty of path variations, but Spring still cannot find the beans.

Any help is greatly appreciated. Thanks much.


8 years ago
I currently developed a SWT application in Windows environment. After setting up the libraries, dll and manifest, I managed to create an executable file using NSIS for the application to run in Windows environment.

Now, I plan to have this SWT application running in Linux environment and I have limited knowledge to do so. I don't want to run it using Java Web Start.

Is there any instructions that enable me to bundle up my SWT application in Windows environment and deploy it in Linux to run?

Any tips are greatly appreciated.

Thank you.
11 years ago
I have a DB int column, "myNumber". How do I do wildcard matching using Criteria? Basically, 11 should return 112, 211, etc.

I tried the below, but didn't work... and I assume I had to convert the int column to String first, but wasn't sure how to.



Thank you.
Thanks for the explanation, Paul.... it makes more sense to me now.
All my primary keys are defined something like this:-



In my current application, user A inserts a new record and acquires the newly inserted record.



In the above scenario, the printout displays null ID value.

When I look at the log, it seems like Hibernate only writes to database right after I do the printout.



When I do a flush prior to printout, then it works as expected:-



In this example, is it the time I would need to flush the session? Or is there other way to obtain the ID value?

The one-to-many relation between these 2 tables are set up like this:-



Any suggestion is appreciated. Thanks.
If user A inserts a new record without flushing it, and user B queries the record in split second, wouldn't user B acquire that record with null ID assigned to it?
Is it recommended to flush everytime when insert, update or delete operation is performed?

In my web application, I currently use one transaction per user request, where all insert/update/delete/query are done before comitting the transaction and redirect to jsp. However, in one of my unique scenarios, I noticed the newly inserted row doesn't have an ID value assigned to it yet (assigned as "native" since my primary key uses DB identity) after I queried all rows.
Ben, the "jeezzz" is my out of frustration on the problem, not on you.

I have decided to use a html redirection to handle this issue and have the html set up as the welcome file.
12 years ago
Yup.. not working either... I even tried /* and did print out on the request URI so that I know what's being caught, but even /* is not intercept my welcome file.... jeezzz
12 years ago
I just tried creating an empty index.do right under the app root, but the filter couldn't intercept it either.
12 years ago
I just tried creating an empty index.do right under the app root, but the filter couldn't intercept it either.
12 years ago
I'm running in the servlet container in WAS 6.

Anothe way I could do is to have /app mapped to /index.jsp (instead of the *.do) in the web.xml, and then have index.jsp auto-redirect to index.do.

The reason I can't create an empty index.do file is because every *.do signature is also handled Struts action servlet.
12 years ago
I have an web application, where when user enters http://server/app, it will be mapped directly to http://server/app/index.do



In this application, I'm also setting up a filter to intercept all user requests, making sure they are right authentication to the application. Basically, I'm intercepting all the *.do signature because I'm using Struts.



I have tested this filter and it works if the URL has this signature: http://server/app/*.do. However, it doesn't catch the welcome file's signature (http://server/app).

I tried different url pattern such as / or /* and the filter is still unable to intercept request coming from http://server/app.

How do I go about fixing this?

Thanks.
12 years ago
I'm still experimenting with Hibernate, and I would really appreciate if someone could provide me some feedbacks on my mapping configuration.

My test app has 3 database tables: PERSON, CAR and CARTYPE. The relationship between PERSON and CAR is one-to-many, and CARTYPE to CAR is one-to-many.

These are my JAVA bean classes:-


These are my database tables:-




Basically, a person can have many cars. The CARTYPE table is more like a dictionary where it has a list of available car names, like Mustang, Ford, Honda, etc. So, CARTYPE is totally independent from other tables.


This is my mapping configuration:-
=========================================


May I know if my mapping configuration above is set up correctly? I saw a Hibernate example (Order, LineItem, Product) which is very similar to what I have here, but it pretty much consolidates the CAR mapping into PERSON using COMPOSITE-ELEMENT tag and I wasn't quite sure what's going on there.

Thanks much in advance!
Holy macro! I never ever thought the solution would be that complicated!

I was reading through that pdf... and sounds like majority of the options require me to either re-jar commons-logging.jar, or set the class loader to PARENT_LAST. Geeez... I'm not really fond of doing either step just to get the log4j to work with hibernate in WAS 6.

In fact, I already had to endorse antlr.jar in WAS 6 so that my HQL query to work with throwing nasty exceptions.

Anyway, thanks Paul, I appreciate your help.