Jay Chmiel

Greenhorn
+ Follow
since Mar 13, 2009
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 Jay Chmiel

Kengkaj Sathianpantarit wrote:
BlogDao should save blog, not save post.
It should be like this:



Ok, so i changed the code. Now I get the stacktrace on blogDao.save(blog) line:

It laso happens when i add the line newPost.setBlog(blog); as Mark Spritzler advised.

Kengkaj Sathianpantarit wrote:
Are you sure you have data in database?
Can you also post your mapping file?



Yes, im sure that the posts are in DB and they have blog_id set properly. Here goes my mapping file:



Thanks for all of you guys for helping me.

Mark Spritzler wrote:
Can you remote debug and check line 9 where you call blogDao.getBlog(blogId) and stop past the line and examine the blog object in your debugger.



Well there is the System.out statement i used for debug. Its line 12:



It shows that size of collection is 1, so there is something wrong with it already.

Mark Spritzler wrote:
Also can you post your code that is in the getBlog() method so that we can see your query you are running, but only if you find after you remote debug that the blog object returned doesn't have the correct data.





Any ideas?
I use Springs SimpleFormController to write Post objects into database:



Then i load the blog using my dao in another controller:



Then finally i print all the posts from the blog in the jsp:



The problem is that the collection of posts always contains only one post, although i can see that there are more in database. Seems that not all are loaded from db. Any suggestions will be appreciated...

As in title - tomcat doesn't see the hibernate mapping file although it is in place. Here is fragment of my applicationContext-hibernate.xml:


Thats what tomcat says when trying to deploy my webapp:


applicationContext-hibernate.xml as well as bloggy.hbm.xml are in /WEB-INF/ directory. What is interesting is that this code works under jboss-5.0.0.CR2(release candidate), but under jboss-5.0.0.GA (stable) and jboss-5.0.1.GA (stable) same problem appears. Thanks for help in adv.
15 years ago
Are you sure you want to use Acegi? Spring Security is based on Acegi and it makes life a lot easier.
Here is the code I'm trying to execute:

in my browser i see only
${blog.title} ${blog.description}
I know that the collection consists of 3 blogs, so it should appear 3 times, but it doesn't.
I've got jstl.jar and standard.jar in my classpath. Any ideas? Thanks in adv.
15 years ago
JSP
Hi good people,

I'm coding a simple blogging portal using Spring MVC and Spring Security + Hibernate. Im stuck on problem I don't know how to solve. The problem is in create blog functionality. User inputs title of new blog and description. Now to succesfully store the new blog in DB (I want to do this from within controller) i need UserId property of Blog object to be filled in with current user in session id. But I've got no idea how to get to the id from within controller. From jsp i can use request.GetUserPrincipal().getName() and execute it agains dao, but I don't think that using dao from jsp level is a good idea. I've got this feeling that I can't see the solution which probably is simple. Help!