7:00 – 4:00 VTX
- Finished Communication Power and Counter-power in the Network Society
- Started The Future of Journalism: Networked Journalism
- Here’s a good example of a page with a lot of outbound links, videos and linked images. It’s about the Tunisia uprising before it got real traction. So can we now vet it as a trustworthy source? Is this a good pattern? The post is by Ethan Zuckerman. He directs the Center for Civic Media at MIT, among other things.
- Public Insight Network: “Every day, sources in the Public Insight Network add context, depth, humanity and relevance to news stories at trusted newsrooms around the country.”
- Hey, my computer wasn’t restarted last night. Picking up JPA at Queries and Uncommitted Changes.
- Updating all the nodes as objects:
//@NamedQuery(name = "BaseNode.getAll", query = "SELECT bn FROM base_nodes bn") TypedQuery<BaseNode> getNodes = em.createNamedQuery("BaseNode.getAll", BaseNode.class); List<BaseNode> nodeList = getNodes.getResultList(); Date date = new Date(); em.getTransaction().begin(); for(BaseNode bn : nodeList){ bn.setLastAccessedOn(date); bn.setAccessCount(bn.getAccessCount()+1); em.persist(bn); } em.getTransaction().commit(); - Updating all nodes with a JPQL call:
//@NamedQuery(name = "BaseNode.touchAll", query = "UPDATE base_nodes bn set bn.accessCount = (bn.accessCount+1), bn.lastAccessedOn = :lastAccessed") em.getTransaction().begin(); TypedQuery<BaseNode> touchAllQuery = em.createNamedQuery("BaseNode.touchAll", BaseNode.class); touchAllQuery.setParameter("lastAccessed", new Date()); touchAllQuery.executeUpdate(); em.getTransaction().commit(); - And we can even add in query logic. This updates the accessed date and increments the accessed count if it’s not null:
@NamedQuery(name = "BaseNode.touchAll", query = "UPDATE base_nodes bn " + "set bn.accessCount = (bn.accessCount+1), " + "bn.lastAccessedOn = :lastAccessed " + "where NOT (bn.accessCount IS NULL )")
