How do I create a NamedQuery using a foreignkey as a parameter?

I need to be able to create a named query that would perform the action but the ORG_ID it is a foreign key in containers and the methods is an Organizations type rather than a long. Therefore I couldn’t figure out how to create a namedQuery that would work. This could be my answer if you have someone who knows how to write the query.
This is what I have done so far but is not giving me the results that I need...
My table names for the query I am trying to perform are..
Organizations (onetomany)
Containers (manytoone)
In Organizations…
@OneToMany(mappedBy = "organizations")
private List<Containers> containersList;
In Containers…
@ManyToOne
@JoinColumn(name = "ORG_ID")
private Organizations organizations;
I have a named query in Organizaions to pass the org_id. It returns the containers list that I can drag on to my jspx. Currently all the containers display. (There are 130 rows of data.) I only need a subset of data based on the Containers table column named type_id. I need to be able to display the type_id's as links, then allow the user to click on it to display the containers for that type_id (and the organization, which is why I am trying to use the containerslist off the organizations namedquery).
Thanks for your help,
Tracy

Hi tracy, I'll illustrate what you may need with a sample pojo. Hope its gonna get you on just fine.
@Entity
@NamedQueries({@NamedQuery(name="Test.findByDate", query="select o from Test t where t.date_ =: now")}
Public class Test implements Serializable{
Private long Id; private Date date;
/*getters and setter**/
Sample sessionbean
@stateless
Public class TestAFacade implements TestA{
Public List<Test> findTestByDate(Date date){
List<Test> testEntities=new ArrayList<Test>();
testEntities=em.createNamedQuery("Test.findByDate").setParameter("date_", date).getResultList();
Return testEntities;
Above should give an idea of how its done. this hasn't been compiled or tested yet. I typed it off my phone.
Google should bringup more accurate and tested samples.
For a foreign key relationship, the entitymanager will manage the object map of the associated columns.
What I'll do is to wrap the parameter into the object -FK e.g patient where the date will be the test-patient referential column.
And the namedquery operation in the sessionbean does the rest.
Good luck. Any1 gonna help with jdev 11g ide and her issues??
Edited by: sherrif on 12-Apr-2010 07:47
Edited by: sherrif on 12-Apr-2010 07:53

Similar Messages

  • How do I create a submenu using Muse

    How do I create a submenu using muse

    Hi,
    Kindly refer to the following links:
    Vertical Sub Menu
    Adobe Muse - Submenu - Sub Menu - Drop Down Menu - Navigation - YouTube
    Adobe Muse Getting Started - Adding A Navigation Bar - YouTube
    Regards
    Sonam

  • How Do I create a Ringtone Using an mp3??

    Hi
    As the topic suggest. How do I create a ringtone using a mp3 instead of buying ringtones from iTunes?
    Thanks
    Baz

    madgroundhog wrote:
    I've tried this method, but it's still not working for me, for some reason. I've got the 3GS. I followed the instructions, and the created ringtone is showing up in iTunes in the Ringtone section. When I connect my iPhone to my Mac, & it appears as a device in iTunes, my ringtone appears there... it just doesn't appear under the ringtone options on the iPhone itself... what am I doing wrong here? Am I looking for it in the wrong place?
    Make sure to sync your ring tones.

  • How can i create splash screen using netbean?

    how can i create splash screen using netbean?

    Welcome to the Sun forums.
    gabbyndu wrote:
    how can i create splash screen..Java 6 offers a splashscreen functionality. See [New Splash-Screen Functionality in Java SE 6|http://java.sun.com/developer/technicalArticles/J2SE/Desktop/javase6/splashscreen/] *(<- link)* for details.
    [Java Web Start|http://java.sun.com/javase/technologies/desktop/javawebstart/index.jsp] has offered splash screens to applications since Java 1.2. See [How can I provide my own splash screen?|http://java.sun.com/j2se/1.5.0/docs/guide/javaws/developersguide/faq.html#206] in the JWS FAQ for more details.
    .. using netbean?We don't support Netbeans here. Ask that on a [Netbeans forum|http://forums.netbeans.org/].

  • How can i create slaes order using BAPI

    hi all,
    i didnt work on BAPIS .how can i create sales order using BAPI here i should pass Z values.
    Moderator message : FAQ, search for available information. Thread locked.
    Edited by: Vinod Kumar on Sep 13, 2011 12:22 PM

    Hi!
    There are a lot of answered threads regarding your question. Try searching first. Below is a sample link.
    BAPI_SALESORDER_CREATEFROMDAT2
    Regards,
    Steph
    Edited by: stephquion on Sep 13, 2011 8:25 AM

  • How do we create a vendor using portal?

    how do we create a vendor using portal.
    creation process needs to trigger workflow.
    Sonali

    You need to use WLST online. I am not sure what your exact requirements are but one good way of working this is to have a WLST script that deletes all your WL customisations, like connection pools, JMS Servers etc and then creates it. That way you can run the same script repeatedly and it will get everything up to date for you. However you have to remember that everytime you add something new you need to update your delete section. Also your deleting should not fail if the item does not exist. I hope that makes sense!
    As to the specifics of WLST examples to do this then check out the WLST examples in CodeShare.
    If you are still having issues then post another message.
    Geoff

  • How can I create DVD Label using Photoshop Elements 10?

    How can I create DVD label using Photoshop Elements 10?
    Richard

    You can create the design for a DVD label in Create>More Options. Once you have the label set up, you would copy it to a template for the labels you plan to use. (The PSE template makes one label, while most printed labels are two-up.)

  • [Forum FAQ] How do I create calculated measure using AMO in SQL Server Analysis Services?

    Introduction
    In SQL Server Analysis Services (SSAS), you can create a calculated measure in SQL Server Data Tool (SSDT)/Boniness Integrated Development Studio (BIDS). Sometimes you may need to create calculated measure by using AMO in a C# or VB project.
    In this article, I will demonstrate so how to create calculated measure using AMO in SSAS?
    Prerequisites
    Before create calculated measure using AMO, you need to ensure that the following components were installed in your server.
    The multidimensional database AdventureWorks Multidimensional Model 2012
    A SQL Server with SSIS and SSAS installed
    The AMO libraries installed:
    X86 Package (SQL_AS_AMO.msi)
    X64 Package (SQL_AS_AMO.msi)
    Solution
    Here is the detail steps to create calculated measure using AMO in SSAS.
    Open SSDT and create a new SSIS project.
    Drag Script Task to the design surface.
    Click SSIS-> Variables to open the Variables window and add two variables that used to connect to the server and database.
    Create a connection to connect to SSAS server.
    Rename the connection name to ssas.
    Double click the Script Task to open Script Task Editor.
    Add Connection and Database variables to ReadWriteVariables textbox and then click Edit Script button.
    Add AMO reference in the Solution Explore window.
    Copy the script below and paste it into the script.
    Dim objServer As Server
    Dim objDatabase As Database
    Dim strDataBaseID As String
    Dim objCube As Cube
    Dim objMdxScript As MdxScript
    Dim objCommand As Command
    Dim strCommand As String
    objServer = New Server
    objServer.Connect("localhost")
    objDatabase = objServer.Databases("AdventureWorksDW2012Multidimensional-EE2")
    strDataBaseID = objDatabase.ID
    If objDatabase.Cubes.Count > 0 Then
    objCube = objDatabase.Cubes("Adventure Works")
    If objCube.MdxScripts.Count > 0 Then
    objMdxScript = objCube.MdxScripts("MdxScript")
    objMdxScript = objCube.MdxScripts(0)
    Else
    objCube.MdxScripts.Add("MdxScript", "MdxScript")
    objMdxScript = objCube.MdxScripts("MdxScript")
    End If
    objCommand = New Command
    strCommand = "CREATE MEMBER CURRENTCUBE.[Measures].[Multipy Measures By 3]"
    strCommand = strCommand & " AS [Measures].[Internet Sales Amount] * 3, "
    strCommand = strCommand & " VISIBLE = 1 ; "
    objCommand.Text = strCommand
    objMdxScript.Commands.Add(objCommand)
    objMdxScript.Update()
    objCube.Update()
    End If
    objServer.Disconnect()
    Then you can run this SSIS package to create the calculated measure.
    Applies to
    Microsoft SQL Server 2005
    Microsoft SQL Server 2008
    Microsoft SQL Server 2008 R2
    Microsoft SQL Server 2012
    Please click to vote if the post helps you. This can be beneficial to other community members reading the thread.

    Thanks,
    Is this a supported scenario, or does it use unsupported features?
    For example, can we call exec [ReportServer].dbo.AddEvent @EventType='TimedSubscription', @EventData='b64ce7ec-d598-45cd-bbc2-ea202e0c129d'
    in a supported way?
    Thanks! Josh

  • How can I create an iBook using iBooks Author using images from a PDF?

    I have a complex book with custom fonts and lots of images, and the client wants it on the iPad. So my most reasonable option seems to be to take images from a PDF and use them for the pages. However, images in iBook Author don't get "laid out" as expected in Portrait mode. How can I  create a layout that is essentially one image per page in portrait mode, and then convert that to landscape mode? Or is there an easier way to go about this?

    tk0us wrote:
    Make sure you have disabled portrait in the Inspector.
    I don't understand why portrait mode defaults images and other "widgets" to thumbnails. The original format of the book (and of 99% of all books I'm guessing) is in portrait format. By forcing the book to work only in landscape mode it's forcing the page image to be half the size, and that makes using this book particularly difficult. Is there no way to force the pages to be full-size in portrait mode?

  • How do I create a journal using iPhoto 11 on a mac?

    Any idea how I can create an iphoto journal on my mac like I can do when using iphoto on my phone or ipad? I can't seem to make a Journal from my Mac using iPhoto 11.

    That is not a feature of iPhoto on the Mac  - it is only available on iPhoto for IOS - suggest to Apple - iPhoto Menu ==> provide iPhoto feedback.
    LN

  • How can we create info record using IDOC INFREC?

    Hi Friends,
    Can we create info record using IDOC INFREC. If Yes. How?
    Regards,
    Narendra

    Using IDOC INFREC & FM IDOC_INBOUND_SINGLE

  • How can I create a widget using a visual different from its parent?

    Hi All:
    I have a 8-bit-depth shell widget, how can I create a child widget using 24-bit-depth visual, the child is a XmDrawingArea. I cannot set XmNvisual.
    But why GLwCreateMDrawingArea() can?
    Thanks?

    Move your formulas in a non header column.
    In the cell A2 of the table "aux", the formula is :
    =IF(ISBLANK(main :: A2),"",main :: A2)
    then I applied Fill Down.
    Yvan KOENIG (VALLAURIS, France) mardi 2 août 2011 15:07:54
    iMac 21”5, i7, 2.8 GHz, 4 Gbytes, 1 Tbytes, mac OS X 10.6.8 and 10.7.0
    My iDisk is : <http://public.me.com/koenigyvan>
    Please : Search for questions similar to your own before submitting them to the community
    To be the AW6 successor, iWork MUST integrate a TRUE DB, not a list organizer !

  • How do I create  a PDF using Acrobat 7.0 in Windows 8 from a Visio drawing on a 64-bit system

    I used to be able to create a PDF using Acrobat 7.0 from a Visio drawing in XP. Now I'm running a 64-bit system, no Adobe printer can be installed, and it is unsupported.  Help?

    On a 32-bit system, there is a workaround. I do not think it is possible to get AA7 to work on a 64-bit system (no one has reported success and only 1 has suggested success with AA8). You may be able to print to a PS file and then open that in Distiller. I suspect that is the only way and you will have to find a decent PS printer driver to do it. I suspect the printer driver (and associated AcroTray) will not work in a 64-bit Win8 -- Acrobat and Distiller may.

  • How can I create a chart using data (from formulas) in my header columns?

    Hello,
    I'm wanting to create a chart using formula totals in my header column. When I attempt to click on the chart icon after selecting my header column, the chart button doesn't appear. Any help would be greatly appreciated. Thanks!

    Move your formulas in a non header column.
    In the cell A2 of the table "aux", the formula is :
    =IF(ISBLANK(main :: A2),"",main :: A2)
    then I applied Fill Down.
    Yvan KOENIG (VALLAURIS, France) mardi 2 août 2011 15:07:54
    iMac 21”5, i7, 2.8 GHz, 4 Gbytes, 1 Tbytes, mac OS X 10.6.8 and 10.7.0
    My iDisk is : <http://public.me.com/koenigyvan>
    Please : Search for questions similar to your own before submitting them to the community
    To be the AW6 successor, iWork MUST integrate a TRUE DB, not a list organizer !

  • How do you create *.exe files using Labview6.0

    I shall be grateful if anyone can give me the following info or direct me as to where i can find it..
    (a) What is the procedure of creating executable files using labview6.0
    (b) Do i require any other components other than the labview base package.

    In addition to previous post,
    a) after buying Application Builder (which is included only in LV6i Professional Package), you'll notice a new entry in LV Tools menu (Build Application or Shared Library[DLL]). This opens App Builder (a panel where you can setup many parameters for the VI/LLB to 'build'). It's not complicated and you can use default values for the first try (after selecting your VI)
    b) here is the link to start with App Builder [http://sine.ni.com/apps/we/nioc.vp?lang=US&pc=mn&cid=2448]

Maybe you are looking for