Pedro Lobato Sena

Greenhorn
+ Follow
since Apr 25, 2006
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
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Pedro Lobato Sena

Hi Guys,

I have the following scenario:

Trip has two colums: traveler_id and requestor_id

Person has one column: idPerson

I need to map the Trip to have two instances of Person, one indicating who will be the responsable by the travel(traveler_id) and the another one indicating who requested the trip.

I tried to use two @ManyToOne, but got the message indicating that I should use insertable and updatable false for one of them, that is not what I want.

How should I map it ?

Thanks in advance,

Pedro Sena
Hi Reza,

I will make a couple of test and as soon as I get a result I'll post it there.

Thanks for yours replys, they were very helpful.

Regards,

Pedro Sena
Hi Reza,

I was thinking that, instead of storing the entite SFSB, it's better to store just the correct entityManager in Seam, isn't it?

Another question that I have:

Using this approach won't I loose the container management(specially with transaction) of my entity manager ?

Thanks again,

Pedro Sena

PS: I bought your book but amazon is taking to much time to deliver it here in brazil(more than a month), hope your book can help me too
Hi Reza,

First of all, thank for your reply.

This database architecture if from a legacy system, that we can't change right now.

We have some clients that just bought our product because we have this kind of infrastructury, I do not full agree with them, but I undertand.

About the management of those entityManagers, is it possible to do what I described in the first post?

I was thinking:

1) When the client logins, create a SFSB with the correct entityManager for this client.
2) When the client call another service(another EJB, stateful or not) this other EJB will take the correct entityManager from the SFSB(is it possible?How?) and then make what is necessary.

For me, appears to be a good approach, I know it can be not the better, but would solve my actual problem.

What do you think about it? Is it possbible?

Thanks for your time
[ November 21, 2008: Message edited by: Pedro Lobato Sena ]
Hi Guys,

I'm configuring my EntityManager programatically, using:


I saw in hibernate documentation that is possible to configure it with orm.xml file. But all my mappings are in persistence.xml file.

I would like to know if is possible to configure my entityManager, using Ejb3Configuration and my persistence.xml file.

I would not like to mantain to almost-identical files in my system, specially a file that change so much, like persistence.xml

Thanks for your time,

Pedro Sena
Hi Guys,

We are migrating a system that has a database schema for each client(we have 100 clients, more or less). All the schemas have the same tables.

We will use Seam + EJB3 + JPA.

I would like to know what is the best approach to design a part of my persistence layer: the management of entityManagers.

I had an idea, but I don't know if it is possible:

Create a SFSB that contains the EntityManager that I need for that specific client(that should occurs when the client makes the login).

Then access this specific SFSB in all subsequent Session Beans that the client may call, being they Stateful or Stateless.

Now my big question:

Is it possible to make sure that my 'secondaries' session beans calls exactly the SFSB that has the specific entityManager that I need ? If yes, how ?

Thanks for your time,

Pedro Sena
I was testing it in JSE environment.

I forgot to include some hibernate libraries, that was the problem.

Thanks
Hi Guys,

I have two situations, both of them with the same point: nullable FK

I have a entity called MasterCity that has a reference to another entity called MasterLanguage.

But some cities has null values for that column. I would like that my object language be null, but instead, I'm getting an exception when I make the search.



I tried the optional attribute in @OneToOne, I also tried nullable = true in @JoinColumn, neither of them worked fine.

I would appreciate some help.

Thanks in advance,

Pedro Sena
Hi,

In this situations, you have to get the object through expressions.

Regards
Hmmm, now I understand. Tnx Satou kurinosuke

[]'s
Hi All,

I have a doubt in question 17, pg 557:

17)Given a tag, simpleTag, whose handler is implemented using Simple Tag model and a tag, complexTag, whose handler is implemented using Classic Tag model.
Both tags are declared to be NON-EMPTY in the TLD.
Which JSP code snippets are valid uses of these tag?(Choose all that apply).

a)

This code snippet above is given as a correct answer, but if BOTH tags are supossed to be non-empty, why <my:complexTag /> is valid?

Tnx in advance
[ April 18, 2007: Message edited by: Pedro Lobato Sena ]
I'm 21.

I was 20 when i did the SCJP.
Kiran, searching for 1.4 mocks you gonna find a lot of old mocks(for 1.2 for example), those mocks have a lot of questions about I/O, awt and other, try to skip them.

Focus on what you really need.
"E" appears to be the right answer for me too.

Originally posted by Akhilesh Trivedi:
Something that interest me is,

http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/http/HttpServlet.html#constructor_summary

"Constructor Summary:
Does nothing, because this is an abstract class."

When an abstract class can not be instantiated, and the only to make use of class is through inheritance, then do we really need a constructor for such a class?



Sure, supose you have an abstract class that contains some objects, in the constructor you could change the states of those objects, specially if you have a constructor that requires some arguments.