A transaction that is isolated means that the transaction in progress is invisible to other transactions until the transaction has been committed. SQL92 supports four different isolation levels. Hopwever the measning of the different isolation levels differ between databases.
I am working on an web application that uses DB2 and sets a transaction isolation level as follows: transactionIsolationLevel of READ_UNCOMMITTED
– the data is visible as soon as it is written to the table. Basically, data is visible by other transactions even if commit() has not been invoked. This mode provides basic transaction support, but dirty reads , nonrepeatable reads, and phantom reads are all possible. Note that the Oracle database does not support this mode.
Locking – we do optimistic.This allows concurrent access to the data, but must implement a stratgey for competing updates (an update must be rejected if the data to be updated has changed since the prospective updater last read it).
for updates: for the row you plan to update, save the data asoociated with the primary key as ‘the original’ , then when you enter the update method, you check to see if the row has been updated by checking ‘the original’ bean data for the entry, and doing a lookup on the data in the database using the primary key from ‘the original’ data. if its finds data based on the originals primary key, the data is the one you stored away as original, and has not been updated. However, if it does not find the entry based on ‘the original’ primary key, means it no longer exists. Next, we continue on with other update checks by seeing if any of the data for the current entry has been changed by someone else since we saved out ‘the original’. If any of the data has changed, we don’t allow the update. Furthermore, you might check if the changes you are making don’t duplicate an existing entry in the table.
for inserts: you might check if the entry you are adding don’t duplicate an existing entry in the table.
for deletes: it pretty much similar to updates except you dont have to check field by field on the entry to see if it has been changed by someone else. All you are checking here is if the entry still exists. You might have a check to disallow certain entries from being deleted.
Link: programmer to programmer
I think I have decided to do the certification thing after about five years in the java world. Not sure where I will start, but some sites I will check out are:
Or, I could try this free Sun JAVA test
An intermediate class decouples between presentation-tier clients and business services.
On the where to use for the Business Delegate pattern, I think it says it best by indicating :
Hide the underlying implementation details of business service.
From Brett McLaughlin’s article on Business Delegate pattern, he says that its builds on the builds on the Business Interface pattern. It mentions to read up on this here as it is part of the EJB best practices series.
Other related links :
I while back Baseball Blogger/Poet Humbug came up with the Periodic List of Bloggers.
I saw the ROTS as this web site refers to it. Sitting in the theater I am thinking I have almost 30 years invested in watching this sci fi saga. The fight scenes light saver style were great. Seeing Anakin just turn on the evil switch just did not do it for me. But, overall I liked the film and how it tied up the loose ends.
I am not sure what to make of this web site http://darthside.blogspot.com/
View – renders the content of the model – access data from model and decide how to present it – forward user input to controller.
Tiles provides a framework for defining and dynamically populating page layouts.
The JSP file will define a template with placeholders where the content should go.
When the JSP file is invoked, it replaces the place holders with content creating a page
which is an instance of the layout.
Enabling the Tiles plugin:
<set-property value="/WEB-INF/tiles-defs.xml" property="definitions-config" />
<set-property value="0" property="definitions-debug" />
<set-property value="0" property="definitions-parser-details" />
<set-property value="false" property="definitions-parser-validate" />
A Tiles definition specifies the layout for a piece of content.
Tiles can insert into a JSP using the definition name which consists of:
name or identifier
set of attributes associated with the definition
a layout JSP name (instance file name of the given definition and attributes)
Using the Tiles Tag libray in JSP file:
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
<tiles:insert> – Inserts a tiles definition or attribute into a JSP page.
Note: the attribute ‘template’ is deprecated (1.2)
It is replaced by the attribute ‘page’ .
<tiles:insert template="/templates/Header.jsp" >
<tiles:put> – Defines an attribute (or parameter) for a definition.
Note: the attribute ‘name’ specifies the name of the attribute
<tiles:put name="page_title" direct="true">
Using the Bean Tag libray in JSP file:
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<bean:define> – Defines a variable to be associated with a bean property
<bean:define id="codeText" name="securityListForm"
<bean:message> – Display a text replacement string associated with an identifier (prop file)
<bean:write> – Display a bean properties value (name can be bean name or bean variable defined for jsp)
<bean:write name="CodeListForm" property="code" />
Using the logic Tag libray in JSP file:
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<logic:iterate> – Iterate over a list
<logic:iterate id="codes" indexId="index"
<logic:greaterThan> – execute logic if condition met
<bean:size id="listSize" name="listForm" property="list"/>
<logic:greaterThan name="listSize" value="0">
<logic:equal> – execute logic if condition met
<logic:equal name="securityListForm" property="tabNumber" value="20">
Using the HTML Tag libray in JSP file:
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<html:form> – form definition
I attended the TriJug meeting with Gavin King of JBoss. Gavin is one of the founders of the Hibernate (Object/Relational Technology). He is also co-author of the book Hibernate in Action which covers version 2.0.
Just a few notes from the meeting:
Hibernate 3 is the recent version. Supports annotation to document O/R mapping, allthough you can still use XML to indicate this.
There was a question from audience asking about a situation where they had their database in production in one schema, and the same database for design in another schema. Gavin was like I don’t see why you would want to do that.
He indicated that hibernate would still be a good fit for applications that did alot of joins, but as always you are limited by the speed of the database.
I asked him if Hibernate would be enhanced to support JDO. He indicated NO. He basically said that they are against the JDO spec. That was the main thing I wanted to get answered at this meeting as JDO and Hibernate seem similar. But, Hibernate is strictly a O/R implementation where as the JDO implemntations follow Sun’s specification.
As far as JBoss, Mark Fleury has had a busy week, and he talks about Gluecode here. His point in the blog entry about Open Source model being validated now that IBM has bought this technology is true. But, this was already the case as IBM’s Portal product is built ontop of the Jetspeed open source product.
When I heard about the GlueCode purchase by IBM yesterday I did not think about the ramifications to other Open Source Application Servers. With IBM adding to their portfolio of Enterprise solutions, this does put more pressure on other lower end application servers.
I wonder what this means to Tomcat in particular. Stay tuned…
Nice writeup on this by Bobby.
Reaction from JBOSS
"with hql and its other mechanisms of querying a database (e.g. the criteria api), hibernate has successfully taken root and i believe is on its way to supplanting sql"
Should we do the validation on client or on the server.
Anything web or browser specific should be done on the client.
Otherwise, we should do it on the server side.
Typically, Business Objects can be called from non-web entities. Therefore, having validation there is a good idea.
- forward is performed internally by the servlet
- the browser is completely unaware that it has taken place, so its original URL remains intact
- any browser reload will simple repeat the original request, with the original URL
- redirect is a two step process, where the web application instructs the browser to fetch a second URL, which differs from the original
- a browser reload of the second URL will not repeat the original request, but will rather fetch the second URL
- redirect is always slower than a forward, since it requires a second browser request
- beans placed in the original request scope are not available to the second request