Federico Nafria

Greenhorn
+ Follow
since Sep 30, 2010
Merit badge: grant badges
For More
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
1
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Federico Nafria

hi!

I'm using a a login page defined in web.xml



What is the best way to retrieve resources like CSS or Images to be used in the login page?

Thanks!
13 years ago
JSF
Thanks Christian,

I'm just starting to use jsr303 and I would like to know if you can point me some tutorial or book. I'm particularly interested in the business and data access layer..

Thanks again,

Federico Nafria.
Hi, I'm doing some tests and I need to persist some entities.

I just wanted to know if, when I get a constraint validation error, there is some way to know what constraint is being violated?

I get this


It's really hard to know what constraint is being violated when you are persisting entities with a lot of attributes and containing other objects.. :S

Thanks for your answers!
Hi Christian, and thanks again!

The blog was extremely clear, I'm going to try it right now. Hope everything works.

I assume that if a want to use another database, I just have to add the datasource and the resource in the domain.xml and put the driver in the lib folder, just like in a full installed glassfish.







Hi Christian, Thanks for your reply!

I've been able to make it work setting a few properties on the container before starting it


When i didn't do that, the error was the same as if there was no domain.xml in the resources folder. It said that it could not initialize the container.

Another small thing, I'm asking it here, because at this moment I can't try it, is it possible obtain an instance of the EntityManager in a test? I mean using context.lookup(¨xxxx¨) inside the test class, in the same way I obtain the instances of the Session Bean?

Thanks.. ;)
Hi!

I'm trying to implement testing on Session Beans, and after trying for a few hours, I've been able to make jUnit tests run into Glassfish embedded.

Now Im facing another problem, the tests run fine, until I insert a Persistence.xml inside the META-INF folder. I've "stolen" the persistence.xml from another proyect that uses an installed glassfish (where it works perfectly) and the jdbc resource used in the persistence.xml is defined in the domain.xml file insidesrc/main/resources/org/glassfish/embed

If somebody could tell me why is this happening I'll be extremely thankful!

Driv
Is it possible to test session beans that use criteria queries with ejb3Unit ?

I get a NoSuchMethodException when the beans invokes the getCriteriaBuilder() method...

Thanks!
I'll go with an example to make it easier:

Let's suppose we have the following classes: Person, Address and Country

a Person has one Address and an Address has one Country.

When you persist a Person, you want the Address to persist with it, don't you?

well, if you mark it with CASCADE.persist it will.

Now, what about country, we do not want to create a new country in the database every time we persist an Address. So we leave without changing the default CASCADE policy.

Hope it's been useful!