eve agostini

Ranch Hand
+ Follow
since Nov 01, 2005
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
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 eve agostini

You are right! I mean, the class was there but the package was wrong (refactoring consequences...)
Thank you!
Hi all,
I have 2 class, one that inherits from the other and I'm using InheritanceType.SINGLE_TABLE with a column that identifies if the entry belongs to the base class or to the derived class.

This is the base class:



And this is the derived class:






To load the object from the database I use the following method:



Where utenteClass is either the base class or the derived one.

I've used this approach before and it worked. While now, even if the utenteClass is the derived class (if I debug I can see it), in the query that is generated the discriminator from the base class is used:


I really can't find the difference from the other project of mine in which this works. I need to use the right class since I need the right object to be instantiated and all the fields of the derived class to be populated.
What can be the reason for which this does not work? Is there another way to get what I need?

Thanks for any help.

Eve

Hi all, I have a little issue with viewScoped.

I have a very simple managed bean:


And an xhtml page:



If i click on the commandLink tha page is reloaded, the variable updated and everything works fine. But if I force page reload clicking on the browser button, the bean is instantiated again; so the constructor is called and the variable reinitialized. Is this the expected behavior or am I missing something?

Thanks

Eve

12 years ago
JSF
It turned out the error was caused by another field, placed just above the "gruppi" one in the class, which I omitted in the code above...not sure why in the exception that field was mentioned...anyway there was actually something wrong in the other field...I solved the problem :P

Thanks for your help!

Eve
Thanks for your answer

I think I'm putting the persistence.xml file in the wrong place.

I've read I can:

define the unit by placing a JAR file in the lib directory of the EAR, the persistence unit will automatically be visible to all modules in the EAR



So, that's what I tried to do.

Here is the structure of my appplication:


and this is the structure of the DB2 jar file:



I get this exception:
java.lang.IllegalStateException: Unable to retrieve EntityManagerFactory for unitName provaPU


I also tried to put the persistence.xml file directly in the archive (without the META-INF directory) but in this case the application won't event start and I'm getting this exception:
Caused by: java.lang.RuntimeException: Could not resolve a persistence unit corresponding to the persistence-context-ref-name [prova.NewSessionBean/entityManager] in the scope of the module called [EnterpriseApplication3#EJBModule1.jar]. Please verify your application.

Here is also the persistence.xml file itself:


Thanks for your help

Eve
Hi all,
I'm trying to set up a ManyToMany relationship but I'm getting the following error:


Exception Description: The @JoinColumns on the annotated element [field gruppi] from the entity class [class users.model.entities.Utente] is incomplete. When the source entity class uses a composite primary key, a @JoinColumn must be specified for each join column using the @JoinColumns. Both the name and the referencedColumnName elements must be specified in each such @JoinColumn.


I'm a little confused because I don't think I'm using a composite key....

Here is the code for the class Utente (owner of the relationship):



And here is the code for the class Gruppo:




It must be something very stupid but I'm just not seeing it!

Thanks for any help

Eve
Hi
is it possible to invoke the same EJB3 Session Bean from two different client applications (web application) but in such a way that each different app persists on a different database?
Thanks!

Eve
Hi all!
I'm getting in touch with EJB3 and trying to figure out if it makes sense to use it with JSF and which is the best way to do it.
I'm new to EJB while I've been using JSF for a while (JsSF 2 now).

In particular I'm getting a little confused about the integration of JSF managed beans and EJB session beans. I know that I can inject an EJB session bean in a JSF managed bean; but it's also true that I actually could invoke EJB session bean's method directly from an xhtml page and just bypass managed beans. I mean, which is the best way to share responsibilities among them?

Also, I got a little confused about scopes. I set up a little app with a managed bean and a stateless session bean. I though that the stateless session bean was supposed not to maintain state but it does (a member variable value is kept among different invocations). And this is true both in case the managed bean has request scope and in case it has session scope. Is it just a coincidence? I mean, because of the fact that the container is responsible for creating and destroying beans so I cannot be sure that the stateless bean is actually reinitialized at each request?

Thanks for any help

Eve
Thanks for the advices! Actually I'm giving a try to another 3D lib at the moment, but I'll try to modify my Java3d test following your suggestions.
13 years ago
You can create an offscreen Canvas3D and use the renderOffScreenBuffer() method:

Canvas3D
13 years ago
Hi, I'm using an Offscreen Canvas to create an image with Java3D: I render offscreen on an instance of ImageComponent2D, created with a BufferedImage. I need to do that again every time something changes in the model. The problem is that the allocated memory increases every time I render the offscreen canvas for a new rendering, but it never decreases. After a while a get an Out Of Memory exception. If I look at the heap dump there are a lot of ImageComponent2D, ImageComponent2DRetained and RenderedImage objects, which were not deleted.

Here is the piece of code that perform the offscreen rendering:



Thanks for any help
Eve
13 years ago
You need to put the inputText components and the command button in the same form, otherwise the variables in the bean won't be set.
(as an alternative you may use a value change listener)
13 years ago
JSF
You have to reset the variables whose values are used to populate the form after you have passed the values to your business code
13 years ago
JSF
You have an error in you jsp page, post that code
13 years ago
JSF
Hi all,
I'm looking for a way to use Java 3d in headless mode. I'm trying to render some 3d images on a server without graphical interface; I'm using an offscren canvas and I don't actually need a graphical interface. But if I set headless mode I get an expception when I try to get a GraphicsConfiguration, which I need to instantiate the canvas. Is there any wourkaround for this?

Thanks
Eve
13 years ago