Best way to implement a simple read of multiple stings from a db

Hello guys,
I am trying to read a collection of countries (Strings) into a collection inside a Movie object. The countries reside in a separate DB table with a FK referencing the Movie.
My questions:
1) What is the best way to implement this? Do I need a seperate entity 'country' ? Is there a general way to read many strings into a collection?
2) the countries list does not have to be updated, only read. How do I make sure it is not persistent?
I have noticed that in my JPA implementation (in netbeans) I do not have something like CollectionOfElements (that is present in hybernate).
Thank you,
Marek

>
My questions:
1) What is the best way to implement this? Do I need a seperate entity 'country' ? Is there a general way to read many strings into a collection?
Probably yes, you need to have one entity for country.for getting the right answer, Post it here - Enterprise Technologies - Java EE SDK (http://forums.sun.com/forum.jspa?forumID=136)

Similar Messages

  • Best way to implement m to n relation?

    Could you please give me some advice on the best way to implement m-n relations in apex?
    Example: I want to store server and database info. A server can have multiple database of course. But in case of a RAC database, the database can be running on multiple servers. So I have tables:
    create table SERVERS (id number primary key, name varchar2(30));
    create table DATABASES(id number primary key, name varchar2(30))
    and an m-to-n table
    create table SERV_DB(serv_id number references SERVERS(id), db_id number references DATABASES(id), instance_name varchar2(30))
    So the table SERV_DB can tell me e.g. that database PROD is running on server 'prdsrv1' with instance PROD1 and on server 'prdsrv2' with instance name PROD2
    How would you design an apex page to maintain this information (adding relations, updating instance names, etc)? I have a solution using checkboxes and 2 for-loops over htmldb_application.g_f40 (to process checkboxes) and g_f41 (to process text fields with instance names) and some delete statements but the logic behind it looks too complex for me. I am convinced that this can be done more simpler. Seems like a common problem to me, so I wonder if there is no out-of-the-box solution in apex for this?
    Could you please show me or create a small demo application with the solution that looks most elegant to you?
    Thanks,
    Geert

    Thanks for your reply. You modified the question slightly, but conceptually it is still the same. What you call the instances table corresponds with my serv_db table. I understand the solution you propose using the tabular report. If I see it correctly, you would have an insert button above the tabular report for each new relation (instance - server) you would want to add. This is ok for the case i used (databases, servers, instances) because there are relatively few relations. However I would not like this solution for other cases. E.g.:
    case: you have a list of persons and a list of tasks. You want to assign tasks to persons in a way that each person has multiple tasks to do and each task can be assigned to multiple persons.
    Suppose you add a new person, and you want to assign 15 tasks to him. The solution above (with the tabular report) would be quite some work because you would have to click 15 times on the insert button and on each click select a task from the select list. In this case it would be more appropriate to, after selecting the new person, see a list of all tasks (e.g. 30 tasks) with a checkbox in front, so you can mark 15 out of the 30 checkboxes and press submit. It gets more complex when you want to assign also an attribute to the relation, i.e. showing the list with all tasks, a checkbox in front and a select list next to each task where you can choose from e.g. "priority high" or "priority low" to indicate that this task is high or low priority for that person. Is there an easy way to implement that?

  • Event Structures​-best way to implement this UI?

    I am trying to write a VI to control & read data from 4 different "channels" (each measuring a DUT) at once.  I have written all the VI's for initializing instruments, communicating with the devices (VISA, GPIB), setting bias, reading data, etc...that has all completed. I just need to write the overall program with the user interface to allow the user to control these 4 channels & display the measured data.....as it turns out, this is the tricky part! My head is spinning from trying to figure out how to handle all the possible events.
    Basically for each channel, I want the user to be able to
    -enable/disable it  for measurement (e.g. if  there is no device loaded in Ch.3, we don't want to measure Ch.3..maybe disable/grey everything)
    -set bias conditions (only if channel enabled). Allow user to change bias "in real-time" by increment/decrementing (e.g. incrementing from 5.00 V to 5.01 V, for example).
    -turn biasing on/off (again, only if channel is enabled)
    Also,  I want each channel to display its measured data (e.g current, temperature reading)..every second or so. No graphs or anything fancy (for now! ), just numeric indicator. 
    Honestly, this all sounds so simple but I'm having trouble figuring out the best way to implement this, due to the fact that 1) there are multiple channels needing to be monitored for events  2) large number of user events that could occur (seems like at least 4 per channel - enabling/disabling, turning bias on/off, incrementing/decrementing bias values, etc ), Also the if a channel IS enabled, i want to be continously reading/displaying the data.  What is the best way to handle this? Should i have 4 separate while loops, each with an event structure to handle events for that particular channel..or will that give me grief somewhre? 
    Also, I have another nagging question. Pretty much all the examples I see re: Event Structures and booleans involve latched booleans, eg. buttons that are just pressed once and pop back up...e.g. buttons you press to tell it to complete a task (e.g. "Acquire Data" or "Stop") , and once it's pressed it's over and reset.  In my case, some of the booleans would not be latched...e.g. the "Enable Ch.2" button would be 'TRUE" as long as i want Ch. 2 to be read....does that make sense? Then, say hours later,  if i did want to disable that channel,  i would change it to "FALSE" and while that would be an "value change", the new value would not be "TRUE"..does that make sense? So  not sure if that would be dealt with the same way in an Event Structure. 
    Hope this all makes sense and many thanks in advance for any help!!!

    You're halfway there. I'd say the best solution is a producer/consumer structure, the event structure is used to generate queued commands to the consumer loop.
    All data is handled in the consumer loop, where you among other things have an array of clusters of channel/instrument settings. (I usually have several cluster, one for test data, one for instrument settings, one for general settings and so on)
    The event structure can have a 1 sec timeout, in which you queue up a Measure command.
    In the consumer, in the measure state you loop through your instruments and if enabled you measure them and update their indicators.
    The general (smart) way to setup the queue is with a cluster containing 2 elements, a typedef'd Command and a variant.
    This way you can send data with the command in any form which is then interpreted in the consumer.
    If, e.g. you press the Enable button on a channel, you can enqueue Enable and the channel number.
    /Y
    LabVIEW 8.2 - 2014
    "Only dead fish swim downstream" - "My life for Kudos!" - "Dumb people repeat old mistakes - smart ones create new ones."
    G# - Free award winning reference based OOP for LV

  • What is the best way to implement a cluster-wide object ID generator?

    What is the best way to implement a cluster-wide object ID generator?

    What is the best way to implement a cluster-wide
    object ID generator?Always use 3 because it is prime.
    Alternatively more information about the system and the needs of the system might prompt alternative ideas some of which are likely to be better than others for your particular implementation and system constraints.

  • Best way to implement this code in labview

    Hi
    What is the best way to implement this code in labview programming.
    I have an analogue input which triggers a boolean light when it reaches a certain voltage. but at the same time i would like it to enable two other outputs one for a set period of time and the other stay on until another statement becomes true.
    For example
    case 1:
    Set output high
    Delay(2000ms)
    Set output low
    Case 2:
    Set output high
    If statement 2 is true
    then set out put low
    if not then repeat until statement is true
    Thanks for your help

    Hi David,
    The code you posted will work, although note that the front panel becomes 'unresponsive' - as changes in the controls are only read once per iteration.  The wait function is an example of an execution timing VI, however if we want to do software timing (like a 2 hour wait) - we should use software timing VIs.
    Check out the following example (note we can stop execution during run-time):
    Regards,
    Peter D
    Attachments:
    SoftwareTiming.vi ‏26 KB

  • Best way to implement FREE purchase?

    Hi,
    I have purchases that are free for logged in users. What's the best way to implement a no-payment solution? Would having the payment fields hidden and COD auto-selected if the amount field is 0.00 a good idea? Is there a better way anyone has implemented this? And how about security flaws?

    Hi
    Here is an article about "no cost" orders
    COD payment method will not work for zero value orders , you will need to use the Free payment method described
    in this article http://kb.worldsecuresystems.com/893/bc_893.html
    Hope this helps!

  • What is the best way to implement writable many-to-many relations

    As everyone knows, the many-to-many associations provided by BC4J are quite good to read many-to-many associations, but they are not able to write such associations.
    There are other solutions using composite associations or cascading-delete foreign keys, but as I was tought now, they are also quite problematic. See thread Internal error: Entity.afterRollback.status_dead   -- What does this mean? for more details.
    So I ask you: What is the best way to implement writable many to many associations? Do you really have to manage them "by hand"?
    Thanks for your ideas
    Frank

    I'd appreciate any hint
    Thanks

  • Best way to implement a standard layout across application

    What is the best way to implement a standard layout across the application?  For example, I am converting an HTML/ColdFusion site to Flex and I need to keep the look of the existing site in the new Flex app.  I need a standard layout on every screen in the new app with a standard header, footer and left nav bar.  Do I need to add that code to every screen in the app or can I just create on layout file and call that into every screen?  Thanks!

    There a few that will help you, look for Form and validator.
    Sincerely,
    Michael
    El 16/05/2009, a las 14:01, lee704 <[email protected]> escribió:
    >
    Thanks.  Are there sample data entry apps in the Tour de Flex samples?
    >

  • Best way to implement connection pooling with tomcat4.0?

    Hi all!
    I need your help:
    What's the best way to implement connection pooling (Oracle Database) with tomcat 4.0?
    I only found ways to implement it in tomcat 4.1, not in 4.0....
    Thanks!
    Michael

    You can use a Datasource managed by tomcat. Earlier versions of tomcat used Exolab's Tyrex for the implementation of the Datasource API which uses connection pooling. Current version uses commons-dbcp and commons-pool (jakarta projects) I think.
    You've got to declare the Datasource in server.xml and then in web.xml of your web app.

  • Best way to implement request-response and still reliability

              HI,
              what is the best way to implement a request -response paradigm and still have
              the reliability that message will be 100% processed and give response...do i need
              to create the permanant queues with storage..
              anybody gives suggestions..
              Akhil
              

    Hi Akhil,
              Temporary destinations can only store non-persistent messages
              as per JMS spec - so they are not useful for reliable for holding
              responses that must survive longer than the life of the
              interested client. For persistence, you will need to use configured
              queues or durable subscriptions. For detailed
              discussion of request/response, I suggest reading the "WebLogic JMS
              Performance Guide" white-paper on dev2dev.bea.com. If you
              have many clients, or expect large message back-logs,
              there can be a performance impact when using selectors...
              FYI: There is a new pub/sub subscriber index enhancement
              that is available in 8.1 and
              in the latest service-packs for 6.1, 7.0.
              "Indexing Topic Subscriber Message Selectors To Optimize Performance"
              http://edocs.bea.com/wls/docs81/jms/implement.html#1294809
              This may be useful.
              Tom, BEA
              Akhil Nagpal wrote:
              > HI,
              > what is the best way to implement a request -response paradigm and still have
              > the reliability that message will be 100% processed and give response...do i need
              > to create the permanant queues with storage..
              >
              > anybody gives suggestions..
              > Akhil
              

  • Best way to implement auto increment in JPA.

    What is the best way to implement auto increment in JPA so that it will support all databases such as MySQL, MSSQL Server, Oracle etc. ? Or is there any way to set auto increment strategy in common place such as persistence.xml? Please help...

    All JPA strategies require something (like a table or sequence object) be in the database, with table sequencing being the most portable, though EclipseLink does allow custom sequence stratgies where you could use something else, such as the UUID. Sequencing is described here described here http://wiki.eclipse.org/EclipseLink/Examples/JPA/PrimaryKey with a custom UUID example shown here http://wiki.eclipse.org/EclipseLink/Examples/JPA/CustomSequencing .

  • Best way to implement Aperture on a shared Mac

    I'm looking for some suggestions on the best way to implement Aperture on my work computer.  It's a 15" MacBook Pro Retina.  Since I don't own the laptop, can I just run Aperture from an external drive in case I have to give the computer up on short notice?  I have a 1 TB Lacie drive (USB 3.0) that currently holds a copy of all of my images.  I don't currently have Aperture, so this would be a completely new install.
    I know I can keep the images on the external drive as Referenced files, but what about the Library?  Can (or should) it be stored on the external drive?  If not, would a backup copy on the external drive (perhaps using Vault) be sufficient for portability?  For example, if I have to give the laptop back could I simply hook the Lacie up to a new MacBook, install Aperture, restore the latest Vault backup and be up and running?
    Any thoughts (pro & con) would be appreciated.

    If you use a fast drive with a relatively fast port (Thunderbolt, USB 3) you can keep your Aperture library on the external volume. But I would keep the Aperture application on the internal drive. If you buy Aperture from the AppStore, your licence would entitle you to install Aperture on any Mac you own or control - for private purposes. So while you have the work computer and control it, you can use Aperture there - for private purposes. Simply delete the app when you return it and unplug your external drive.
    For example, if I have to give the laptop back could I simply hook the Lacie up to a new MacBook, install Aperture, restore the latest Vault backup and be up and running?
    That would work.
    Make sure, your Lacie drive is formatted MacOS X Extended (Journaled), and set the "Ignore Ownership on this volume" flag. I assume, you are using different account names on the two macs.
    You should be able to download Aperture again to your new MacBook, if you use the same AppleID.

  • Air mobile best way to implement drag and drop

    Hi all,
    I'm developing an application which allows people to drag and drop certain panels.
    But the dragmanager isn't optimized for the air mobile platform.
    What is the best way to implement drag and drop at the moment?
    Write it all yourself or are their some utility classes that can help?

    Hi all,
    I'm developing an application which allows people to drag and drop certain panels.
    But the dragmanager isn't optimized for the air mobile platform.
    What is the best way to implement drag and drop at the moment?
    Write it all yourself or are their some utility classes that can help?

  • Best way to code a simple wait/delay?

    What is the best way to code a simple wait/delay so that my application idles for a few seconds before continuing? I'd rather not use a loop to do this and am looking for a better solution. This code will not be threaded, so I'm not going to use sleep(). TIA

    From the OS level, yes it is a process; from Java's perspective, it's a Thread, at least in Sun's implementation.
    According to the JVM specification, section 2.1.9, "The Java virtual machine initially starts up with a single nondaemon thread, which typically calls the method main of some class. The virtual machine may also create other daemon threads for internal purposes. The Java virtual machine exits when all nondaemon threads have terminated."
    http://java.sun.com/docs/books/vmspec/2nd-edition/html/Concepts.doc.html#33308

  • Displaying Multiple Values on GUI components - best way to implement

    Hi,
    my program needs to implement a basic function that most commercial programs use very widely: If the program requires that a GUI component (say a JTextField) needs to display multiple values it either goes <blank> or say something more meaningfull like "multiple values". What is the best way of implementing it?
    In particular:
    My data is a class called "Student" that among other things has a field for the student name, like: protected String name; and the usual accessor methods (getName, setName) for it.
    Assuming that the above data (i.e. Student objects) is stored in a ListModel and the user can select multiple "Students", if a JTextField is required to display the user selection (blank for multiple selections, or the student "name" for a single selection), what is the best (OO) way of implementing it? Is there any design pattern (best practice) for this basic piece of functionality? A crude way is to have the JTextField check and compare all the time the user selections one by one, but I'm sure there must be a more OO/better approach.
    Any ideas much appreciated.
    Kyri.

    Ok, I will focus on building a solution on 12c.
    right now I have used a USER_DATASTORE with a procedure to glue all the field together in one document.
    This works fine for the search.
    I have created a dummy table on which the index is created and also has an extra field which contains the key related to all the tables.
    So, I have the following tables:
    dummy_search
    contracts
    contract_ref
    person_data
    nac_data
    and some other tables...
    the current design is:
    the index is on dummy_search.
    When we update contracts table a trigger will update dummy_search.
    same configuration for the other tables.
    Now we see locking issues when having a lot of updates on these tables as the same time.
    What is you advice for this situation?
    Thanks,
    Edward

Maybe you are looking for