Shayan Shah

Greenhorn
+ Follow
since Aug 28, 2009
Merit badge: grant badges
For More
Pakistan
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 Shayan Shah


I wonder if my question is really vague Or is it that no one knows the solution???
12 years ago
JSF

Hi All,

I want to develop a web app that contains an "Menu Area" and "Active Area". That "Active Area" points to a page in the "Controller" managed bean and loads it by ajax request. The page to be loaded is set by ajax request through "A4j:Commandlink" and renders the "Active Area'. Here is the code

1. Index.xhtml


2. Menu.xhtml


3. Include1.xhtml


4. Controller.java


Now, when a page is loaded to active area that as you see contains a "a4j:commandButton" with an actionListener, if the button is clicked, instead of calling the listener method, the page is loaded again, and the when the second time the button is clicked, the page is loaded as well as the listener method is called. Which means that whole page is refreshed again and view is then set and method is called. In richfaces 3.3.x, I used to use "a4j:include" for the active area. Everything worked fine. Now in richfaces 4.x, I have to use ui:include component. 3.3.x had “a4j:region” component to isolate a region. But in 4.x its bahavious has been changed.

Now I dont know how to isolate this region to be re-rendered and the Ajax request. I want only the active are to be changed instead of the whole page to be refreshed.

Thanks
12 years ago
JSF
well, not that much horrible..
Actually I am stuck with a problem in doing true pagination. Here is the code

The backing bean



The class that extends DataModel for pagination



the jsf page



Now here when the first time page is loaded, everything is ok. When I hit '2' to show the second page, the method "getTableModel" in 'Paginator' backing bean is called three times. first in "APPLY_REQUEST_VALUES" phase and then two time is in "RENDER_RESPONSE" phase. In real situation where data base will be involved it means three database hits which is surly not a good thing. First I dont want database hit in "APPLY_REQUEST_VALUES" phase as it will again query db. If I get to know that this method is being called in "APPLY_REQUEST_VALUES" phase then I can restrict it.and Secondly, I have no Idea that why is the "getTableModel" method called twice in "RENDER_RESPONSE" phase.

Thanks in advance
13 years ago
JSF
Hi

I want to access the current PhaseId when a method is called on a managed bean given that the bean has not implemented the PhaseListener interface. Means to know what is the current phase in which this method is being called. Is it possible? I have googled but could not find any working way.

Regards
13 years ago
JSF
Hi

I have a client application that uses EJB3 beans by remote lookup. For performance reasons I cache the remote references in a map.
Now does this force the client application to always use the same EJB3 instance as same reference is used again and again or does EJB pooling still works and returns other instances from the pool for requests handling?
The application server I am using is JBoss 5.1.

thanks
Hi

I have a client application that uses EJB3 beans by remote lookup. For performance reasons I cache the results of EJB3 lookups in a map.
Now does this force the client application to always use the same EJB3 instance as same reference is used again and again or does EJB pooling still works and returns other instances from the pool for requests handling?

thanks
13 years ago
As according to JPA recommendations, I am using the @Lob on the ''image' field which is of type byte[] and fetch type is lazy.

public class Member implements Serializable {
...........

@Lob
@Basic(fetch=FetchType.LAZY,optional=true)
@Column(name = "image")
private byte[] image;

...........
}



According to this, when I query, the images must not be loaded into memory as its Lazy fetch but still they are being loaded.
I am using Hibernate as persistence provider. what can be the problem?

Thanks
Yeah. Its the only way. Now I create temporary images on server A when I get the list, and send its paths in response. But now I have another problem.
As according to JPA recommendations, I am using the @Lob on the ''image' field which is of type byte[] and fetch type is lazy.



According to this, when I query, the images must not be loaded into memory as its Lazy fetch but still they are loaded.
I am using Hibernate as persistence provider. What can be the problem??

Thanks
Well, I have two servers A and B. The core application is installed on server B. HTTP requests are received to server A which then queries server B and returns result. So there will be remote calls from server A to server B.

Now when serve A requests from server B all the list of users, server B will return the list along with the Images. When server A all the records in hand, I want that server A should make the images and return it as HTTP response. Not like that it make separate remote request again for each image again from server B.
Hi

I am storing users data in a table along with pictures using JPA. I have successfully stored the images in data base. I have to display the data on a JSF page in data table along with the pictures. Now I am facing the problem of how to display the pictures. When I retrieve the data, all the records are fetched along with the pictures in form of byte arrays. I am only stuck on how to display the images.

I found several programs on Internet which used to pass Id of the image to a servlet which will retrieve the image and process it and send as a response which means for 10 pics, there will be 10 seperate full cycle requests to database when I am already having all the pics loaded to memory. I don't want to make a separate request for each image of each record. Reason being its a distributed application. Every call means a remote call and serialization and all that other stuff.

Is there any possible solution to this.

Regards
Hi

I am working on an application that needs to be highly performance efficient. We will be having heavy data stored in data bases. And will be having hundreds of requests per minute and for each request will interact with database.

Now JPA ease us from writing SQL and many more, but in this sceneraio, will JPA be that efficient as it adds an extra layer over the JDBC and generates SQL which we can write directly?

Also we have another module that heavily communicates with database, will JPA be performance efficient or JDBC in this case?

Thanks
I guess you didnt got my question. EJB can be injected to servlet but if both web module and ejb module are in same EAR. The problem I am facing in injection is when both are not in same EAR. EJB module is deployed as JAR and web module is deployed as WAR. What about DI in this situation??

Hi

Can we inject an ejb to a servlet given that the ejb module and web module are not packaged in an EAR but deployed in same container instance?? I am facing problems in this kind of situation.
I wonder if this is even supported or not? I am using JB0SS 5.1.

Thanks

This exception means that isolation of deployments also effects jndi lookups/naming or the way components are accessed. I have googled this problem but so far, could not get any solution.
13 years ago
problem solved by isolating both the deployments by jboss.xml. but now another problem has arisen. These two separate deployments will also communication with each other. that is C1MyBean will lookup C2MyBean and send some request to it. but the lookup fails. so then what is the possible solution for this problem?? I was of the guess that their would be no problem as I am accessing by JNDI name. I also tested it by using remote interface but no use. the exception that is thrown is

13 years ago