Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
Win a copy of Pro Spring MVC with WebFlux: Web Development in Spring Framework 5 and Spring Boot 2 this week in the Spring forum!

David Crecente

+ Follow
since Nov 24, 2006
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by David Crecente

If you get an exception when you call the method getNextScheduleDates on pagerSchedDao, what is happening?

In the case of:
1) SQLException?
2) Any of your application exception?
3) A RuntineException?

Thank you.
Hi, thank you for your awnser.

I am using DAO pattern but, I have to open the transaction in some place. This place is the class which calls the DAO classes, inside the try - catch block. (The DAO layer has several facades).

JSF -> Bussiness layer -> DTO layer -> DAO layer.
The calls are made between DTO and DAO layer. Between facades.

If there is other way to do it (the try - catch block), could you put a piece of code?.

Thank you again.
Hi all,
In my current project I am using hibernate in the persistence layer.
I used to do these tasks with EJB 2.1. Container Managed Transaction. And I used to define the scope of transacitions in deployment descriptors.
But now, I have to do these things.

I would like to know the best way to manage the transaction with hibernate.

I suggest the next one:

Thank you in advance.
Hi Mike,
thank you for your answer.
I didn't specify java classes because I tried serveral mappings and I didn't get correct constrains for my tables.

Finally I am creating the model in the database and reverse engineering later. This way is much quick.

Thank you again.
Hi all,
I am having problems mapping two relations among tables.
I am using EJB3, so standard java persistence.

1) First relation definition.
The idea here is that a category may belongs to many categories. A many
to many relation but with itself.

2) Second relation definition.
It is a simple many to many relation between CATEGORY and LOCALE but
the table CATEGORY_LOCALE has more properties. Mayby I might write a
CategoryLocaleEntity with a composite primary key but this composite
key should be a composition of id in CATEGORY and id in LOCALE.

Thank you in advance.
Hi all,
I have failed a question on that I don't understand after seeing the specification.

According to the specification, in a stateful session bean CMT, on its ejbCreate method, I could have access to other enterprise bean (page 80). But, according to the page 76, ejbCreate runs with an unspecified transaction.

If I can't protect these calls defining a transaction attribute from this ejbCreate, why can I perform methos on other enterprise beans?

Thank you in advance.

Page 80 allowed operations stateful session bean CMT

SessionContext methods: getEJBHome,
getEJBLocalHome, getCallerPrincipal,
isCallerInRole, getEJBObject,
JNDI access to java:comp/env
Resource manager access
Enterprise bean access

Page 76

A session bean�s newInstance, setSessionContext, ejbCreate, ejbRemove, ejbPassivate,
ejbActivate, and afterCompletion methods are called with an unspecified transaction
context. Refer to Subsection 17.6.5 for how the Container executes methods with an unspecified
transaction context.