Bradley Rintoul

Greenhorn
+ Follow
since Apr 01, 2003
Merit badge: grant badges
For More
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 Bradley Rintoul

Reza Rahman wrote:Bradley,

You are using Hibernate I am assuming? If so, one option is to switch persistence providers. TopLink/EclipseLink/Kodo/OpenJPA handle lazy loading more gracefully. The other option, of course, is just to implement the Object.clone() method and get an "unadulterated" copy when you need it :-).

Hope this helps,
Reza



Yes, I'm using Hibernate. Yeah, I thought about doing some sort of a "clone" operation or something... What I have done which *appears* to have gotten around the problem was called "set<thing>" with a null argument. I was thinking that would choke, but somehow it managed to circumvent the problem. Kinda odd that there isn't a simple way to turn a detached object back into a true "POJO"...

Thanks for your help!

I have a problem which I'm pretty sure bumps up against some fundamental issues of JPA and managing the persistence of objects in general (and my lack of understanding of it) ...

So, I have a stateless session bean which simply uses an EntityManager to find an object by its primary key. This entity object has a one-to-many association which I would like to be lazily loaded. This is all pretty much fine and dandy. Now, when I try to return this object through a web service (JAX-WS 2.1) using JAXB for the binding, I get a lazy- load-outside-of-a-session-fial. I'm no stranger to these, but isn't there some way that I can "completely detach" my nice little object so that it doesn't have the proxies or whatever hanging around it so that the call to "get" the list just runs the code in the getter (which checks for null list and creates empty list)?

Is what I've written making enough sense to get some help..?
I have a SFSB which I am storing a reference to in the web session. It seems like after an exception is thrown (and not handled "immediately") in the SFSB, the proxy to it becomes useless. I get a "Could not find stateful bean" exception upon trying to use it after the exception is thrown.

Is there anything I should keep in mind when thinking about exceptions and SFSBs?

Thanks!
I have a question about selecting on a timestamp value... I have a column/field which is a TemporalType.TIMESTAMP and I want to find all objects in the database with a timestamp of a certain _date_ only. I don't care about the hours/minutes/seconds, etc. I have used "truncate" in the case of an Oracle query, for example, but I have no idea how to perform an analogous operation in JPQL! Help me, please!

If I need to make anything more clear in my problem, please let me know...

TIA,

Brad

Originally posted by Amit M Tank:
Make your logger member variable static.



Now why didn't I think of that?!?

Hello. Quick question about "best practices" here, maybe...

So, I have a stateful session bean that is using a Logger (org.apache.log4j style). I was keeping a reference to it as a member variable, but then realized it is unserializable... Should I just make calls to Logger.getLogger() all the time? Is this expensive?

Thanks for any advice/help.

B.

Originally posted by Edvins Reisons:
The specification covers this, no need to code anything:



Excellent! Thanks!

Originally posted by jim li:
hi guys

Container managed persistence is better when you want to develop a fast solution, but without much control over the system, and the less efficiency than bean managed persistence

on the other hand, the advantage of bean managed persistence is that you have to implement your own methods, so you have more control, but the cost of the implementation is high.

am i correct ?

please give me some suggestions.

thank you

Hello:

I have a stateful bean which has an EntityManager "injected" into it thusly:

@PersistenceContext(name="myDataSource")
EntityManager em;

My question is this: when my bean is passivated, what happens to its EntityManager?

Do I need to do a JNDI lookup or something on PreActivate? Seems like this should be pretty common, but I have not found anything on it, which makes me think I'm nuts somehow!
Hello:

I'm using NetBeans to develop a JSP-based web application. I'm not really too up on Ant so I'm not too sure about the building environment, etc. and I think that's the root of my problem. Anyway, here's the question...

I'm creating some helper classes (with beans style conventions for get/set) that are working fine but they only use java.lang and java.util classes up to this point. I would like to use a third party jar file in one of them, but the "import" fails because it seems the jar file can't be found. I'm not sure where to put the jar file in the project so that it can be seen at compile time! Heeeelllppp!!

Thanks...

B. Rintoul
http://lookahead.mozdev.org
Great. Thanks for the encouragement!

19 years ago
JSP
I'm working on a little ol' JSP site using Tomcat as my container. I'm not entirely new to Java and the whole thing, but I was wondering - is JSTL a worthwhile thing to use or look into? Is it "normal" to use JSTL in a web application, or is everyone using Struts or what..?

19 years ago
JSP
Hello:
I'm trying to debug a servlet in NetBeans using its internal Tomcat server. The trouble I'm having stems from the inability to access a Session object... Is this possible? It seems insane that it's so easy to start debugging a servlet but then no Session object is available...?
Any help in debugging servlets - especially in the NetBeans IDE - would be greatly appreciated.
Thanks,
Bradley
20 years ago
Hello:
I am trying to debug a servlet in NetBeans, but have had trouble getting a Session object to behave. In my investigations, I have determined I need to start the Tomcat server a certain way and then try to attach to its VM... I don't know exactly how to pass these command line parameters to the Tomcat startup script in Linux - can anyone help? I'm not an Linux expert, so I don't feel too confident mucking around with startup.sh. Can anyone spell it out for me?
Thanks a lot,
Bradley
20 years ago