Re: media file folder delete

2013-08-04 Thread Glen Mazza
Well, instead of StackOverflow I did more research on my own about how parent objects update when a child entity they contain are deleted: https://github.com/gmazza/blog-samples/blob/master/jpa_and_junit/src/main/java/SampleRun.java#L72:L108 My results were opposite of what I was getting with Ro

Re: media file folder delete

2013-07-31 Thread Glen Mazza
I'm puzzled here because when I committed those simple changes yesterday I had tested it both with EL and Hibernate. The Roller *application* should be running fine with either JPA stack, but it's not with you? Or are you just testing the test cases and not the application (but even so, mvn c

Re: media file folder delete

2013-07-31 Thread Greg Huber
Glen, I was just testing if hibernate was the solution, and its not, may as well revert back to eclipselink. Just a thought, are there any more like this, where there is a named query and then a delete on the association. Cheer Greg. On 31 July 2013 15:59, Glen Mazza wrote: > You're not s

Re: media file folder delete

2013-07-31 Thread Glen Mazza
You're not supposed to comment out removeChildDirectory(), it's part of the solution now that works both on Eclipselink and Hibernate (at least as I tested on both yesterday), it's not a patch. It just so happens that Hibernate doesn't need that line of code, but it doesn't hurt Hibernate if i

Re: media file folder delete

2013-07-31 Thread Greg Huber
Glen, It still does not work, even if we are on hibernate. If I comment out your mediaFileDir.getParent().removeChildDirectory(mediaFileDir); change it does not delete the folder. So I guess there is something else wrong, or may be its correct and and that is what we are supposed to do on JPA.

Re: media file folder delete

2013-07-31 Thread Glen Mazza
I'm not a email list moderator, and one isn't around right now. Did you try sending an email to "dev-unsubscr...@roller.apache.org" from the gmail account you subscribed from? It should work. Glen On 07/31/2013 09:23 AM, Yufu Huang wrote: > Could someone unsubscribe me from this mail list? I tri

Re: media file folder delete

2013-07-31 Thread Yufu Huang
Could someone unsubscribe me from this mail list? I tried unsubscribe email but did not work. Thanks. Sent from my iPhone On Jul 30, 2013, at 3:36 PM, Glen Mazza wrote: > Fixed the Eclipselink issue in a way that the code will still work with > Hibernate. We'll keep the Hibernate for awhile

Re: media file folder delete

2013-07-31 Thread Glen Mazza
It should be Hibernate -- it's very easy to check, just look at the app/pom.xml, comment one dependency and uncomment the other. (Unless you're running on GlassFish then it's Eclipselink no matter what.) Regardless, it should work with either JPA stack because of my fixes yesterday. Basical

Re: media file folder delete

2013-07-31 Thread Greg Huber
Glen, It builds OK now. I have updated to the trunk but the test is still showing its not refreshing the association. Are we on hibernate or EclipseLink? Cheers Greg On 31 July 2013 13:14, Glen Mazza wrote: > Just one failure as a result of the update (mvn clean install worked > before it).

Re: media file folder delete

2013-07-31 Thread Glen Mazza
Greg, could this be on your end? You must have updated yesterday to get onto Hibernate, and my only changes were minor ones related to Media File stuff. Glen On 07/31/2013 08:14 AM, Glen Mazza wrote: Just one failure as a result of the update (mvn clean install worked before it). And some t

Re: media file folder delete

2013-07-31 Thread Glen Mazza
Just one failure as a result of the update (mvn clean install worked before it). And some typos. :) BTW, the new database script you created, would you mind moving it to test/resources/sql folder? (like we have main/resources/sql already?) Also, I'm usually on the #roller IRC so you might

Re: media file folder delete

2013-07-31 Thread Greg Huber
Glen, I have made some changes to enable local testing and after updating from the trunk nothing is working. http://repo1.maven.org/ says 501. Why does it not ignore this? :( Can you see if the tests still work? Also, I have done the test on the directory and will check this later when its bac

Re: media file folder delete

2013-07-30 Thread Glen Mazza
Fixed the Eclipselink issue in a way that the code will still work with Hibernate. We'll keep the Hibernate for awhile to see if it has any issues. When we delete a media folder, Eclipselink does indeed remove it from the database (the Flush Mode COMMIT/AUTO had nothing to do with the problem

Re: media file folder delete

2013-07-30 Thread Glen Mazza
Np, one sec... On 07/30/2013 07:06 AM, Greg Huber wrote: Glen, OK, can you make the changes to the trunk so i can switch to hibernate. On 30 July 2013 11:47, Glen Mazza wrote: Much appreciated. I was thinking it may be good for us to run on Hibernate for a few weeks anyway, even if Eclipse

Re: media file folder delete

2013-07-30 Thread Greg Huber
Glen, OK, can you make the changes to the trunk so i can switch to hibernate. On 30 July 2013 11:47, Glen Mazza wrote: > Much appreciated. I was thinking it may be good for us to run on > Hibernate for a few weeks anyway, even if EclipseLink were running > perfectly, just to see if there are a

Re: media file folder delete

2013-07-30 Thread Glen Mazza
Much appreciated. I was thinking it may be good for us to run on Hibernate for a few weeks anyway, even if EclipseLink were running perfectly, just to see if there are any kinks with it where our code needs to be tightened up. I can fix EclipseLink's problem in the interim so if/when *Hiberna

Re: media file folder delete

2013-07-30 Thread Greg Huber
Glen, I was trying to add the usecase but ran into the howto debug issue. I will sort the test if I manage to get the debug working. Cheers Greg On 30 July 2013 11:05, Glen Mazza wrote: > Let me play with it today before throwing in the towel and going with > Hibernate. Even if we jump to Hib

Re: media file folder delete

2013-07-30 Thread Glen Mazza
Actually, if you can give me a *few* days (by this weekend), I may need a little bit more time to look at the persistence portion. Glen On 07/30/2013 06:05 AM, Glen Mazza wrote: Let me play with it today before throwing in the towel and going with Hibernate. Even if we jump to Hibernate I stil

Re: media file folder delete

2013-07-30 Thread Glen Mazza
Let me play with it today before throwing in the towel and going with Hibernate. Even if we jump to Hibernate I still need to figure out the EclipseLink matter so our coding is not dependent on one JPA framework alone, we should be able to work with both or have a JIRA ticket with EclipseLink.

Re: media file folder delete

2013-07-30 Thread Greg Huber
Glen, Commenting out the FlushModeType.COMMIT makes no difference, (assumes it switches to auto). Would have thought that createNamedQuery or createQuery would behave the same way as they both follow the same logic in roller. Where one works and one does not, maybe an EclipseLink issue. I am no e

Re: media file folder delete

2013-07-29 Thread Glen Mazza
This page: http://docs.oracle.com/javaee/6/api/javax/persistence/FlushModeType.html says "If |FlushModeType.COMMIT| is set, the effect of updates made to entities in the persistence context upon queries is unspecified", which is different from the definition of COMMIT below (where it *only* occ

Re: media file folder delete

2013-07-29 Thread Greg Huber
Glen, I think its only on the named queries as if I delete a weblog entry it updates correctly, and uses a dynamic query. EntityManager em = getEntityManager(false); Query q = em.createNamedQuery(queryName); // Never flush for queries. Roller code assumes this behavior q.setFlushMode(FlushModeTyp

Re: media file folder delete

2013-07-29 Thread Glen Mazza
OK, we can switch to Hibernate for the time being, and it works fine there, it's as simple a matter as commenting-out the EclipseLink dependency and uncommenting the Hibernate one in the app/pom.xml and doing an mvn clean install to get a new WAR. Still, I'd like to fix this EclipseLink issue,

Re: media file folder delete

2013-07-29 Thread Glen Mazza
I'm getting the same results as you, except "delete" doesn't even visually remove the new folder (even though it says it does); when I restart Tomcat, then the folder disappears--presumably the flush/commit happens at that point. If you have a query tool like SquirrelSQL query the DB during th

Re: media file folder delete

2013-07-29 Thread Glen Mazza
Oh, there is one hiccup as a result of moving from OpenJPA to either EclipseLink or Hibernate, it's this highlighted matter: https://github.com/gmazza/blog-samples/blob/master/jpa_and_junit/src/main/java/SampleRun.java#L44-46, I don't know if this would be related to your issue. (Still have to

Re: media file folder delete

2013-07-29 Thread Greg Huber
>From google: "By default, the database flush mode is set to AUTO. This means that the Entity-Manager performs a flush operation automatically as needed. In general, this occurs at the end of a transaction for transaction-scoped EntityManagers and when the persistence context is closed for applic

Re: media file folder delete

2013-07-29 Thread Greg Huber
Glen, This is the backoffice (struts) so it does not use the cache. This used to work prior to eclipselink, maybe there is some setting we need to update on the EntityManager. This is pretty basic stuff.. Cheers Greg On 29 July 2013 12:25, Glen Mazza wrote: > OK, I'll check, but wha

Re: media file folder delete

2013-07-29 Thread Glen Mazza
OK, I'll check, but what happens if you go to the Roller maintenance tab and click on "Flush blog" (that will normally empty out the cache) -- problem solved then? Note I had to bring back your changes after the move to fewer modules, I might have missed something. Glen On 07/29/2013 07:20

media file folder delete

2013-07-29 Thread Greg Huber
Glen, Can you test whether you can delete a media file folder? ie add a folder and then try and delete it. For me it seems to delete it OK but when you refresh the media file folder view it is still there. If I then shut down tomcat and restart it is gone. It seems something to do with its cac