I am pulling information from a table with multiple lines that all corrorpond to one ticket. If anywhere on the ticket I see a charge for MIlk I want to see all lines associated with that ticket#. I tried to write a subquery but that has not worked for me. Any ideas??
Example:
Item Cost
Yams 1.0
Beans 2.0
Milk 5.0
Yams 1.0
Beans 2.0
Candy 1.0
Beans 2.0
Yams 1.0
Beans 2.0
Milk 5.0
Beans 2.0
Milk 5.0
Something like
select *
from Items
where TicketId in
(
select distinct TicketId
from Items
where ItemName = 'Milk'
)
?
Related
I have a problem when trying to use
#ManagedBean, it appears like this :
#ManagedBean,
Check the image below :
here is a photo of the code
Yesterday, I could create a project and use it, but today I cannot, I don't know what happened , maybe because I changed GlassFish 4 to 5 , and PostgreSQL 9.3 to 10?
EDIT: I tried to see my others project, and they are all stricken out in #ManagedBean.
The crossed line (aka "strikethrough") on a class, method, or annotation means that it has been deprecated by the author and you should no longer use it. If you mouse over the annotation, it should give you some sort of explanation as to why it was deprecated, and what you should use instead.
In this case, the JSF #ManagedBean annotation was "strongly discouraged" in JSF 2.2, and officially deprecated in JSF 2.3 (hence the strikethrough in your IDE). Instead, you should use the #Named annotation which is provided by CDI and is a more standard way of creating a bean in Java EE.
I have not lot work experience with PrimeFaces. I have to migrate a java web PrimeFaces project from 3.4 to 5.2. Although I searched it all over the internet there was not proper solution for my situation. If you ever have any experience with this kind of problem or ever heard of that please let me know or send me link for that. Basically I want to the way of doing it. I already have idea about witch component should be changed. Is there anything to do except replacing the jar? I already tried to replace PrimeFaces 3.4 with PrimeFaces 5.2 jar. But it does not allow me to replace the jar. Do I have to to change the code too? Please i want the migration steps.
There is a PrimeFaces migration guide. you need to go step by step to get from 3.5 to 5.2.
Here is the full migration guide for your situation:
Copied from MigrationGuide
3.4 to 3.5
Component Changes
DateSelectEvent, ScheduleDateSelectEvent, ScheduleEntrySelectEvents classes are removed, use SelectEvent instead.
Column class in SortEvent and ColumnResizeEvent is replaced with UIColumn to support dynamic columns.
Scrollable and Resizable DataTable-TreeTable features are reimplemented. DataTable and TreeTable no longer render cell container div element with classes ui-dt-c and ui-tt-c.
Sheet component is removed as it duplicated functionality of DataTable. Galleria is reimplemented.
General Changes
IE7 support is phased out.
3.5 to 4.0 Component Changes
MenuModel is rewritten and not backward compatible with the old version.
(skip this when e.g. directly migrating from 3.x to 5.x, it is 'reverted' again in 5.0) DataTable sortBy and filterBy expressions require the plain property name meaning "name" instead of "#{person.name}".
Backward compatibility is maintained for expressions like
"#{var.property}" but not for complex expressions.
FileUpload is reimplemented and it is backward compatible except "showButtons" option is removed.
disabledSelection option of column, moved to DataTable, change is backward compatible and the option will be removed from column in a future release.
AutoComplete: removed process/global/onstart/oncomplete in favor of "p:ajax event="query" process/global/onstart/oncomplete"
General Changes
Preferred way of accessing widgets is via PF('widgetVarName').show(), old way (e.g. widgetVarName.show())
is still supported and will be removed in a future version.
4.0 to 5.0 Component Changes
Chart components are deprecated in favor of new generic chart component with new Chart API. Old chart components are still supported but will be removed in a future release.
ToolbarGroup deprecated, use left and right facets of toolbar instead. (Reverted back as of 5.0.1, both facets and toolbar groups will be supported instead)
Defining fields in sortBy-filterBy attributes is deprecated use a value expression instead.e.g. sortBy="#{user.name}" instead of sortBy="name"
DataTable frozen rows feature take an integer value instead of a collection from now on. This value defined how many rows from the start should be frozen.
LazyDataModel's filters parameter changed to Map instead of Map as a requirement of the new Advanced
Filtering Feature.
Dialog: appendToBody was removed in favor of appendTo="#(body)" to gain more flexibility
Watermark: forElement was removed in favor of for="#(yourSelector)".
Widgets must be referenced via "PF". e.g. PF('widgetVarName').show() instead of widgetVarName.show();
DataTable layout changed to table-layout:fixed.
PrimeFaces Push is reimplemented, PushContext is deprecated, use EventBus instead along with the new Push API.
ScrollPanel is reimplemented, usage is backward compatible however UI is slightly different.
5.0 to 5.1
Support for literal texts in filterBy-sortBy expressions were deprecated in 5.0 and it is removed in 5.1. These attributes only work with value expression as in the past.
Deprecated chart components are removed.
You can't directly migrate from 3.4 to 5.2.
There are some steps given to migrate in MigrationGuide. Perhaps you could first migrate from 3.4 to 4.0 there are some components changes on DataTable, DateSelectEvent, etc. Then you could proceed with 4.0 to 5.0 migration which involves more changes in LazyDataModel's and some of componets. Please go thought link given for MigrationGuide above.
Currently I'm using JSF 1.2 and RichFaces 3.3.3 and they work fine. But am I going to have to update my current RichFaces version up to 4.x and make the changes, coprresponding to the migration guide if I decide to update my JSF version up to 2.1.29. I mean are there components which are not going to work appropriate or ever work at the JSF 2.1.29 + RichFaces 4.x(4.5.2 in particularly) combination. I mean components like a4j:keepAlive which I think should be replaced with something else.
Basically they are going together but with some limitations, because RichFaces 3.3.3 does not support some JSF 2 functionalities like built-in facelets (VDL), Bean Validation (JSR-303), JSF 2 afax functionality, ... see here.
But there are some workarounds to get over the limitations...
The problems you will depends strongly on the used Richfaces Components in your project.
If you want to use JSF 2 (2.0, 2.1, 2.2) and its benefit, I would consider also updating to RichFaces 4 (4.0, 4.1, 4.2, 4.3, 4.4, 4.5) in order to get all the benefits from JSF 2. You need to investigate time for both solutions. But if you go with RichFaces 4, future changes will be more efficient I think.
If you decide to stay on Richfaces 3.3, I would consider update the version to 3.3.4 which consists of a security patch applied to the 3.3.3.Final release and which introduces basic JSF 2 support to the 3.3.X branch.
I need to create the custom component consisting of 3 input fields and provide the ability to create a binding the component to a backing bean. I inherited my component clas from the UIInput. The issue that I need to convert all three inputs into the Date format as follows:
Calendar c = Calendar.getInstance();
c.add(Calendar.DATE, 1);
c.add(Calendar.HOUR, 2);
c.add(Calendar.MINUTE, 3);
Date d = c.getTime();
and set it to the backing bean's property specified with the expression like
value = #{beanName.beanProperty}.
What method should I override to do that?
BTW, this article says that we could provide a similar facility in the Tag class ever. But there described a value-binding (to a bundle, for instance) which is not exactly what I want.
The article you are referring to is very very old, still working whith JSF 1.0 initial release! you can see that in faces-config.xml declarations through the tutoriel:
<!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN"
"http://java.sun.com/dtd/web-facesconfig_1_0.dtd">
I think you should absolutly change that tutoriel as there is no need to using JSF 1.0, as from BalusC's answer:
JSF 1.0 (March 2004)
This was the initial release. It was cluttered with bugs in both the
core and performance areas you don't want to know about. Your
webapplication didn't always work as you'd intuitively expect. You as
developer would run hard away crying.
I see that you tagged JSF 2 in your question, you can find a good start for making composite component using JSF 2.0 from here (which BTW gives a similar example to the one you provided): Composite component with multiple input fields.
I just am placing the outline of my problem here since it is very difficult to depict the real scenario. i have an application in jsf 1.2 and rich faces 3. It stores employees basic data and related data (family, employment record, qualification etc) in separate tables. when user clicks on its own name. details from several tables related to employee are shown on a page. like family, employment record, qualification record etc. primary key in employee basic table is emp_id (a number). this key is foreign key in all related child tables. Application is centrally deployed and used in different cities. the problem is, when a particular employee clicks its details....unknown records are shown in his account like family of any other employee...the interface is like
---------------------------------------------------------------------------
Wellcome Mr. Campatrick,Sales Executive <<View Details>>
---------------------------------------------------------------------------
when view details is clicked....emp_id of Mr.Campatrick is set in the employee_bean. where employee_bean is session scoped. If at all this make any sense....what could be the possible reason of mixing up of records when i categorically set the emp_id on "view details" link. It is something related to "Memory leak"? if yes, where to check it.
The problem looks to be an abuse of managed beans in session scope. Since you say you work with JSF 1.2 and RichFaces 3, I would recomend to change your managed beans from session scope to request scope and add the #KeepAlive annotation to those managed bean that must behave as view scope.
Your bean would look like
#KeepAlive
public class NoSessionScopeAnymore {
//fields, constructor, getters and setters, methods...
}
More info about the KeepAlive annotation or as component: <a4j:keepAlive>
From JSF 2 you won't need this since you can use the #ViewScoped that solves the bridge between request and session. More info about managed bean scopes:
https://stackoverflow.com/a/7031941/1065197
Communication in JSF 2 - Managed Bean Scopes
is Sessionscope put any impact on the application performance? (is tagged as JSF 2 but this applies for JSF 1.2 as well)