-
1. Re: Expression Language (EL) Entity Lookup Mystery
nickarls Jun 4, 2013 3:21 PM (in response to wlovett)I think userProject only exists as a temporary variable for the lifetime of that components rendering.
-
2. Re: Expression Language (EL) Entity Lookup Mystery
wlovett Jun 4, 2013 4:09 PM (in response to nickarls)Nicklas, thank you for your reply.
If that is true, I am getting the variable while the component is being rendered.
In other words, let's say I put another column in the table.
<tr:table value="#{ValueHolder.projectUsers}" var="userProject">
<tr:column id="c10">
<tr:panelHorizontalLayout inlineStyle="#{userProject.project.lastReviewStyle}">
<tr:outputText value="#{Dashboard.lastReviewText}"/>
</tr:panelHorizontalLayout>
</tr:column><tr:column id="c2">
<tr:panelHorizontalLayout inlineStyle="#{userProject.project.someMoreInfoStyle}">
<tr:outputText value="#{Dashboard.someMoreText}"/>
</tr:panelHorizontalLayout>
</tr:column>
</tr:table>
When "#{Dashboard.lastReviewText}" is called, the variable should still be "alive" so to speak because the component is not yet finished rendering, but it is not. I should note that this EL expression / backing bean combo works fine in Weblogic.
-
3. Re: Expression Language (EL) Entity Lookup Mystery
nickarls Jun 5, 2013 2:13 AM (in response to wlovett)One would think so, if the EL context is the same. It could of course be an EL implementation issue. Are they CDI or JSF managed beans?
-
4. Re: Expression Language (EL) Entity Lookup Mystery
wlovett Jun 7, 2013 8:10 AM (in response to nickarls)They are JSF managed beans. I'm thinking it's an EL implementation issue. Some other people are working on a different way of porting the program over (with their own problems), but this isn't one of them. They can get #{userProject.project} to work in a backing bean.
At any rate, I've come across a stumbling block with ADF skinning. Turns out 10g implements this much differently than 11, and there's no good way to merge the two using JSF 2+. So I'm trying to implement JSF 1.1 instead so I can pull in the 10g skinning. We'll see if the skinning issue is fixed that way.
-
5. Re: Expression Language (EL) Entity Lookup Mystery
wlovett Jun 12, 2013 7:04 PM (in response to wlovett)Well, slight progress, but I'm basically back at square one. I've implemented the 10g tags and am using <web-app version="2.4"> in my web.xml so my program looks correct now. I'm also able to get #{userProject} in a backing bean (yay!), but I'm not able to get #{userProject.project}. That returns null. Here's the code:
Projectuser pu = (Projectuser) EL.get("#{userProject}");
Project project = pu.getProject(); // returns null;
String color = project.getLastReviewColor(); // causes a NPE
Is this something that needs to be configured in my persistence.xml?
It does not matter whether I bundle JSF 1.1 with my WAR or if I let the default Mojarra JSF run. It get the same error either way.
Any ideas? I'm open to just about any of them.
** Edit: **
Changing the fetch type to "fetch=FetchType.EAGER" in my ProjectUser entity does not help
-
6. Re: Expression Language (EL) Entity Lookup Mystery
wlovett Jun 12, 2013 8:05 PM (in response to wlovett)It appears that querying ProjectUsers does not return a reference to the Project table.
In my backing bean, I have a beforePhase(PhaseEvent event) function. This function queries the ProjectUser entity and populates a List which is used by the .jspx's table. It appears the items returned from this query do not contain references to Project entities for some reason.
Why? My code in the ProjectUser entity is like so
@ManyToOne(fetch=FetchType.LAZY)
@JoinColumn(name = "PROJECT_ID", referencedColumnName = "PROJECT_ID")
private Project project;
Is this something I need to explicity set in my persistence.xml? Right now I only list the class names and eclipselink targer-server and target-database.
<provider>org.eclipse.persistence.jap.PersistenceProvider</provider>
<jta-data-source> ... </...>
<class>com.sample.ProjectUser</class>
<class>com.sample.Project</class>
<properties>
<property name="eclipselink.targer-server" value="JBoss"/>
...
-
7. Re: Expression Language (EL) Entity Lookup Mystery
sfcoy Jun 12, 2013 11:49 PM (in response to wlovett)The ProjectUser query that populates the List should "join fetch" any related objects that it is expecting to use while rendering.
-
8. Re: Expression Language (EL) Entity Lookup Mystery
nickarls Jun 13, 2013 1:41 AM (in response to sfcoy)So #{userProject} is the EL-reference in the iteration that points to a UserProject and userProject.project.lasReviewStyle can be used in the dataTable but not when accessed from backing bean code? What is the true class (some proxy?) of the UserProject you get from backing bean access? If stuff works in the dataTable, the JPA relations must be set up OK, right?
-
9. Re: Expression Language (EL) Entity Lookup Mystery
wlovett Jun 13, 2013 9:11 AM (in response to nickarls)Guys, thanks for both of your replies.
Turns out the (test) database's foreign keys are messed up. I'm not quite sure how THAT happened, but I did some manual changes and can pull back records no problem now.
I was starting to go bonkers there. Thanks again for the help. Both of you have replied on a number of my posts and I really appreciate it.