Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!

carlos fernandez

Greenhorn
+ Follow
since Mar 30, 2004
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 carlos fernandez

I tend to send one every week - I haven't gotten a response to the last few. They are probably getting ready to file a restraining order

Carlos
<vent>
I am starting to get a little chafed! I submitted my assignment and took the essay exam almost 3 months ago. I can't even get SUN to confirm that they have received the materials. For all I know my assignment got lost in the intertubes!

Normally I wouldn't care - but I keep seeing people receiving their scores after 3 or 4 weeks.

that is all.
</vent>
BTW - i am designing part 2 with EJB 3, which makes domain modeling a bit easier than with EJB 2

Carlos
Does anyone have a sense if the graders are looking for the use of a rich domain model versus transaction scripts (http://martinfowler.com/eaaCatalog/transactionScript.html)?

Carlos
after working on several spring based web applications I am working on my 1st EJB 3.0 app.

The main user groups are "customers" that perform actions on their own behalf and "agents" who perform acts on behalf of customers.

I don't want to pollute my service layer method signatures with a "user" parameter for every method that needs to know the user it is executing an action on behalf of.

I believe the various methods on the EJBContext related to authentication/authorization such as getCallerPrincipal(), isCallerInRole() etc are used to resolve these issues. For instance, the impl of a method named getActiveOrders() could use the name of the Principal to look up the customers active orders.

However, when an "agent" executes methods (e.g. getActiveOrders()) they are typically acting on behalf of a user. So when an agent executes getActiveOrders(), they want to see the orders for the user they are serving.

Using a custom HTTP based stack for service method invocation, I could propagate this information by adding the "acting on behalf of user XX" information as HTTP headers on the client side and reading them on the server side using an HTTP filter.

However, I have no idea how to accomplish this inside the confines of an EJB application (JSP front end - presentation and service layer may or may not be collocated in the same VM)? I would strongly prefer a standards based solution.

Carlos
I have an issue with the "pay for itinerary" SD.

I am using an interaction frame to refer to the "Price Itinerary" SD in the course of the "Prepare Itinerary" SD. This seems straight forward because "Price Itinerary" has a single input message (some kind of itinerary) and a single output message (some kind of price).

On the other hand the "Pay for Itinerary" SD seems to have at least 3 incoming messages (basic flow):
- the itinerary that is going to be paid for
- the customers "CC"
- the CC to use for payment

The only examples of gates or parameters/return values (for example, the Developerworks articles by Donald Bell) only show a single input and a single output.

How do you package up a more complex SD like "Pay for Itinerary" to use as an interaction diagram in the "Prepare Itinerary" SD?

Do I use the standard gate for an input and output message and just add another lifeline to represent the external context (e.g. some sort of controller or series of screens), passing additional messages into and out of the external context lifeline?

Thanks in advance.

Carlos
Windows XP Pro SP2
JDK 1.5.0_05
Oracle 9i
Oracle Thin Driver for JDK 1.4 v.10.2.0.1.0
DBCP v.1.2.1
Spring v1.2.7 (I am using the JDBC template for convenience)
________________________

I have run into serious performance issues reading BLOBs from Oracle using oracle's JDBC thin driver. I am not sure if it a constraint/mis-configuration with oracle or a JDBC problem.

I am hoping that someone has some experience accessing multi-MB BLOBs under heavy volume.

We are considering using Oracle 8 or 9 as a document repository. It will end up storing hundreds of thousands of PDFs that can be as large as 30 MBs. We don't have access to Oracle 10.

TESTS
I am running tests against Oracle 8 and 9 to simulate single and multi-threaded document access. Out goal is to get a sense of KBps throughput and BLOB data access contention.

DATA
There is a single test table with 100 rows. Each row has a PK id and a BLOB field. The blobs range in size from a few dozen KB to 12MB. They represent a valid sample of production data. The total data size is approx. 121 MBs.

Single Threaded Test
The test selects a single blob object at a time and then reads the contents of the blob's binary input stream in 2 KB chunks. At the end of the test, it will have accessed all 100 blobs and streamed all 121 MBs. The test harness is JUnit.

8i Results: On 8i it starts and terminates successfully on a steady and reliable basis. The throughput hovers around 4.8 MBps.

9i Results: Similar reliability to 8i. The throughput is about 30% better.

Multi-Threaded Test
The multi-threaded test uses the same "blob reader" functionality used in the single threaded test. However, it spawns 8 threads each running a separate "blob reader".

8i Results: The tests successfully complete on a reliable basis. The aggregate throughput of all 8 threads is a bit more than 4.8 MBps.

9i Results: Erratic. The tests were highly erratic on 9i. Threads would intermittently lock when accessing a BLOB's output stream. Sometimes they lock accessing data from the same row, othertimes it is distinct rows. The number and the timing of the thread "locks" is indeterminate. When the test completed successfully the aggregate throughput of the 8 threads was approx. 5.4 MBps.

I would be more than happy to post code or the data model if that would help.

Carlos
Does the file specified as the argument to getMimeType() have to include path information? If so, does it have to be relative from the application root? If not, where does the file have to reside in order for the ServletContext to find it?
Carlos
16 years ago
Keith I take everything back that i said.
If you try that -- the method will throw a RolledbackException.
Why didn't this happen when i posted earlier today . . . i sort of forgot to call the business method in question from my client
Carlos
I can't find something to explicitly state this in the spec so i was hoping someone could set me straight.
MDBs have no clients so the app assembler cannot set its <security-identity> to <use-caller-identity>. (section 21.3.4 of spec).
Does that mean that the MDB will throw exceptions when it attempts to call another bean's methods, if the MDB's <security-identity> is not set to a <role-name> (using <run-as> of course) with sufficient authority?
If so, you would only need to specify a MDB's <security-identity > element if it called another bean.
keith i was wondering about this as well. If a Bean Provider can simply ignore the value of a UserTransacton.getStatus() call and call UserTransaction.commit() even is the transaction had been marked for rollback.
Since i couldn't find an answer in the spec or on the boards I wrote a simple session bean that did just that -- and it ran just fine.
It seems that UserTransaction.setRollbackOnly() will not enforce the rollback - the developer needs to check the satus of the UserTransaction and then decide to rollback() or commit().
Granted my experience with EJBs extends to the Reference Implementation container. If you see anything wrong with this please post a reply.
The session bean's biz method was as follows:
public void testBiz(){
UserTransaction ut = ctx.getUserTransaction();

try {
ut.begin();

ut.setRollbackOnly();

System.out.println(String.valueOf(ut.getStatus()));

ut.commit();
} catch (Exception e) { //the methods in the try block throw more than 6 distinct exceptions - i used a broad catch(Exception e) just to see if any exceptions were called and throw a system exception
throw new EJBException(e);
}

}
David Wrote:
--> Why is B correct? It is correct because the select is finding all objects from all the orders out there that are of type lineitems.
I am struggling to understand the meaningful difference between answers B and D in this question.
As i understand it by adding "IN (o.lineItems) li" the EJB-QL statement in answer B, the EJB-QL is simply making the elements in the lineItems collection available as the identification variable "li". It would take another path expression in the WHERE clause to access the elements exposed by "li".
Since I have a SQL background I unfortunately still tend to think about this in SQL terms. It is my understanding that "IN (o.lineItems)" returns the related objects as a separate "table" known as "li". But unless you run any where clause expressions on the elements returned in "li" you won't know if there are matching objects or not.
The only reason that B and D could be correct is because (n) denotes a 1 to many relationship instead of a zero to many. Is that correct? If that is true then all Orders must have at least one LineItem, which makes sense. Which is the only way that D could be correct.
sorry i am late to the game. i was wondering about this as well. I assume that you would be forced to return the entire component interface and then call a getter on the CMR field (similar to the getMovieDirectorName() method on page 397 of the HFEJB book)
I then ran across this in the EJB spec -- section 11.2.8
Because finder methods cannot return arbitrary types, the SELECT clause of an EJB QL query defined for a finder method must always correspond to the abstract schema type of the entity bean for which the finder method is defined. In contrast, the SELECT clause of a query defined for a select method can return the abstract schema types of other entity beans or the values of cmp-fields.
Does this mean that the note on page 406 relates to EJB-QL for finder methods. While select methods could return an abstract schema type for another entity bean?
Carlos
I seem to have lost my pencil sharpener . . .
The first question asks what EntityBean interface container callback method best answers the following question - "the client calls this method to tell the Container that he (the client) is done using the bean's EJB object reference".
the container callback choices are pretty limited, 7 in all:
setEntityContext()
unsetEntityContex()
ejbRemove()
ejbActivate()
ejbLoad()
ejbPassivate()
ejbStore()
And the only one exposed to the client in ejbRemove() (via the home and component interfaces remove()). My problem is that this method does far more than simply kill the EJB object and entity bean instance.
The "there are no Dumb Questions" section on page 357 goes on about how the container garbage collects the EJBObjects and beans they represent - which seems to be the clients real goal in this question.
Is the answer really ejbRemove()? Am i just having last minute exam paranoia?
thanks.
it looks i violated the first commandment of forums before i posted
thy shall scour the forum before posting