How to use a database per customer

Hello,
I currently design an Application that shall be used by multiple customers. Every customer shall have a database by its own for security and performance reasons. What is the best way to do this:
- Create a database schema per customer (no problem)
- Create a persitence unit per customer in peristence.xml (also no problem)
How can I select the correct persistence manager at runtime?
@PersistenceContect(unitName="customer14") EntityManager em;
Selects the Persistence Unit for a bean at compile time. Any idea how I can do this at runtime? I would prefer to keep with container managed Entity Managers, if this is possible.
Thanks in advance for any help.

stelzbock wrote:
Ahh, wow, that was quick!
So all of them have these features I need?
If you mention derby, I just found Java DB which is based on derby. So whats the diference? Can anyone recommend one of them?Check them all. Try which one you like best. I think Java DB is the new name of Derby.
Personally I prefer HSQLDB, but I choose whichever you like.
And what about the Table control? Is JTable feasible? It should be configurable and extendible like this:This is an entirely different question, better asked in the Swing forum.
Also, be careful to separate your DB access from your UI code (google for MVC). It will make your application a lot easier to maintain.

Similar Messages

  • Why and how we use Logical Database?

    Can anybody explain with example why and how we use logical database?
    Regards,
    Rajan

    Hello,
    SAP comes loaded with all the extras. Among the extras that are most helpful to IT managers are all the access routines needed to pull any business object that managers can think of out of SAP databases. However, SAP has not thought of everything where your particular applications are concerned. SAP organizes its standard database tables to service business units based on conventional business applications. Itu2019s likely your business requires something new, perhaps even something exotic. In that case, you will need to create a new database, using information from different places. Basically, you need a logical database. You need to create a virtual business data object repository consisting of a new kind of record or table that suits your purposes. In addition, the repository should be composed of information that is actually stored in a number of different locations, none of them necessarily logically associated with one another. Letu2019s take a closer look at creating logical databases.
    A case for a logical database
    Suppose my company manufactures widgets of the most obscure variety, and they are components of other widgets. I sell my widgets as raw material for the more sophisticated widgets built by others, but in some cases I actually partner with other manufacturers in creating yet another class of widget. Now, in my world, I consequently have customers who are also partners. I sell to them and I partner with them in manufacturing and distribution. Also, I need an application that uses both of these dual-use relationships.
    Essentially, I have a customer database and a partner database. Neither contains records that are structured to contain the identifying particulars of the other. Thus, I need a hybrid database that gives me tables detailing these hybrid relationships. What can I do? I can go the long way around and write a new database, pulling information from both and creating new objects with a customized program that I write by hand. However, this process is cumbersome and contains maintenance issues. On the other hand, I can use SAPu2019s logical database facility, create my logical database in a couple of minutes, and have no maintenance issues at all.
    Logical database structures
    There are three defining entities in an SAP logical database. You must be clear on all three in order to create and use one.
    u2022     Table structure: Your logical database includes data from specified tables in SAP. There is a hierarchy among these tables defined by their foreign keys (all known to SAP), and you are going to define a customized relationship between select tables. This structure is unique and must be defined and saved.
    u2022     Data selection: You may not want or need every item in the referenced tables that contributes to your customized database. There is a selection screen that permits you to pick and choose.
    u2022     Database access programming: Once youu2019ve defined your logical database, SAP will generate the access subroutines needed to pull the data in the way you want it pulled.
    Creating your own logical database
    ABAP/4 (Advanced Business Application Programming language, version 4) is the language created by SAP for implementation and customization of its R/3 system. ABAP/4 comes loaded with many predefined logical databases that can construct and table just about any conventional business objects you might need in any canned SAP application. However, you can also create your own logical databases to construct any custom objects you care to define, as your application requires in ABAP/4. Hereu2019s a step-by-step guide:
    1.     Call up transaction SLDB (or transaction SE36). The path you want is Tools | ABAP Workbench | Development | Programming Environment | Logical Databases. This screen is called Logical Database Builder.
    2.     Enter an appropriate name in the logical database name field. You have three options on this screen: Create, Display, and Change. Choose Create.
    3.     Youu2019ll be prompted for a short text description of your new logical database. Enter one. Youu2019ll then be prompted to specify a development class.
    4.     Now comes the fun part! You must specify a root node, or a parent table, as the basis of your logical database structure. You can now place subsequent tables under the root table as needed to assemble the data object you want. You can access this tree from this point forward, to add additional tables, by selecting that root node and following the path Edit | Node | Create. Once youu2019ve saved the structure you define in this step, the system will generate the programming necessary to access your logical database. The best part is you donu2019t have to write a single line of code.
    Regards
    Arindam

  • How to use Logical database in function module?

    I will create a function module in HR.
    but how to use Logical database  in function module ?  Logical database PNP always show screen.in function (RFC) code , it is a matter.

    You cannot attach the LDB to the main program of the function group.
    - So you may [SUBMIT|https://www.sdn.sap.com/irj/sdn/advancedsearch?cat=sdn_all&query=submit&adv=false&sortby=cm_rnd_rankvalue] a report which use the LDB and get back the data (export/import), by default in the syntax of SUBMIT the selection-screen will not be displayed
    - Use [LDB_PROCESS|https://www.sdn.sap.com/irj/sdn/advancedsearch?query=ldb_process&cat=sdn_all], fill a structured table for selection, and get data back in another table
    - Use [HR function modules to read Infotypes|https://www.sdn.sap.com/irj/sdn/advancedsearch?cat=sdn_all&query=hrfunctionmodulestoread+Infotypes&adv=false&sortby=cm_rnd_rankvalue].
    Regards

  • How to use *MonitorManager* to add custom messages in channel monitoring?

    Hi experts,
    How to use MonitorManager to add custom messages in channel monitoring for custom adapter development(Not in audit log).
    like
    Type   Time Stamp   Message ID   Explanation 
      6/25/11 6:39:47 AM 00199942-6e43-02df-96ca-8b538c63dd98 Message processing completed successfully
      6/25/11 6:39:47 AM 00199942-6e43-02df-96ca-8b538c63dd98 Message with ID 00199942-6e43-02df-96ca-8b538c63dd98 processed
      6/25/11 6:39:46 AM 00199942-6e43-02df-96ca-8b538c63dd98 Message processing started
      6/24/11 6:43:26 AM 00199942-6e43-02ef-96b1-7650f3495e03 Message processing completed successfully
      6/24/11 6:43:26 AM 00199942-6e43-02ef-96b1-7650f3495e03 Message with ID 00199942-6e43-02ef-96b1-7650f3495e03 processed
      6/24/11 6:43:24 AM 00199942-6e43-02ef-96b1-7650f3495e03 Message processing started
      6/23/11 6:45:52 AM 00199942-6e43-02df-9698-5be345a9ddf5 Message processing completed successfully
      6/23/11 6:45:52 AM 00199942-6e43-02df-9698-5be345a9ddf5 Message with ID 00199942-6e43-02df-9698-5be345a9ddf5 processed
      6/23/11 6:45:50 AM 00199942-6e43-02df-9698-5be345a9ddf5 Message processing started
      6/22/11 6:43:30 AM 00199942-6e43-02ef-95ff-2c03493dc078 Message processing completed successfully
    Edited by: SAP_PI_D on Jun 28, 2011 12:10 PM

    Solve by myself

  • How to use query-database() function in transformation?

    Hi All,
    How to use query-database() function in transformation?
    It is giving four fields but if i write select query in sqlquery field it is saying select node is not found....
    plz help me out
    Regards
    Pavankumar
    Edited by: [email protected] on Jul 29, 2009 2:49 AM

    Hi,
    To answer your query:-
    http://abhishek-soablog.blogspot.com/2008/08/orclquery-database.html
    Cheers,
    Abhi...

  • How to use search term2 in customer master record

    hi
    how to use search term2 in customer master record. can anyone tell me plz
    thanks
    monica

    Hi,
    Search Term 2
    Label used for search helps.
    Only uppercase letters are stored in this field. Your entries are converted automatically to uppercase letters.
    There are two of these fields for search terms. These fields can be used independently of each other.
    Procedure
    You can use your own criteria for entering the search term.
    Example
    You can enter the main part of the name or an organizational ID.
    For example, for the company "Hechinger & Sons", you could enter "Hechinger" as the first search term.
    The second search term could then be the name ID you use within your company, to help you identify your data later.
    Please check out the following link:
    http://help.sap.com/saphelp_47x200/helpdata/EN/01/a9b331455711d182b40000e829fbfe/frameset.htm
    Hope this helps.
    Please assign points as a way to say thanks.
    Regards,

  • How to use temporary database?

    hi
    i am using timesten as cachedb for oracle database。i have some problem about how to use temporary database?
    1) what's the difference between temporary and non-temporary database,if i use awt cache group,then timesten will automatically replicate all change to oracle database , even if timesten crashed,i can set up another timesten quickly,no data loss?
    2)since all data is in oracle database,does timesten‘s transaction log and checkpoint file useful ? does timesten need backup ?

    Temporary databases have very limited usefullness; you can't use them with replication or caching for example. They are a very 'niche' use case; I'd recommend that you avoid them for mainstream use.
    TimesTen checkpoiint and transaction log files are always required (except for Temporary database which do not have checkpoint files but do have log files).
    Chris

  • How to retrieve data using logical database and custom select options

    Hi all,
    I have a selection screen which is displayed by logical database PSJ and I have two select options of my own. I need to retrieve data based on both selection screen of logical database and my own select options. How can I do it?
    Thanks in advance.

    Hai Gupta
    Check the following Document & Links
    1. A logical database is in fact
    a program only.
    2. This LDB provides two main things :
    a) a pre-defined selection screen
    which handles all user inputs and validations
    b) pre defined set of data
    based upon the user selection.
    3. So we dont have to worry about from
    which tables to fetch data.
    4. Moreover, this LDB Program,
    handles all user-authorisations
    and is efficient in all respects.
    5. tcode is SLDB
    good info about Logical Database. you can check the link.
    http://www.geekinterview.com/question_details/1506
    http://help.sap.com/saphelp_46c/helpdata/EN/35/2cd77bd7705394e10000009b387c12/frameset.htm
    Re: How to Create and Use ldb in reports?
    Re: Logical databases
    http://help.sap.com/saphelp_46c/helpdata/en/9f/db9bed35c111d1829f0000e829fbfe/frameset.htm
    Functions for displaying and changing logical databases:
    Call Transaction SE36 or
    Choose ABAP Workbench -> Development -> Programming environ. -> Logical databases
    Interaction between database program and report:
    During program processing, subroutines are performed in the database program and events are executed in the report.
    To read data from a database tables we use logical database.
    A logical database provides read-only access to a group of related tables to an ABAP/4 program.
    advantages:-
    The programmer need not worry about the primary key for each table.Because Logical database knows how the different tables relate to each other,and can issue the SELECT command with proper where clause to retrieve the data.
    i)An easy-to-use standard user interface.
    ii)check functions which check that user input is complete,correct,and plausible.
    iii)meaningful data selection.
    iv)central authorization checks for database accesses.
    v)good read access performance while retaining the hierarchical data view determined by the application logic.
    disadvantages:-
    i)If you donot specify a logical database in the program attributes,the GET events never occur.
    ii)There is no ENDGET command,so the code block associated with an event ends with the next event
    statement (such as another GET or an END-OF-SELECTION).
    1. transaction code SLDB.
    2.enter name z<ldb-name>
    3.create
    4.short text
    5.create
    6. name of root node (here Ekko)
    7. enter short text (f6)
    8.node type -> data base table.
    9.create
    10 change logical DB
    riht click on ekko and insert node
    here node name ekpo
    11.create
    12. click on selections
    13. press no Should the changed structure of Z<ldb name> be saved first.
    14.select tables which you want to join.
    15.transfer
    16 now you have to o to coding part.
    17. save
    activate.
    19.click to src code
    double click on first include and activate
    Regards
    Sreeni

  • How to use dynamic database item in Fast formula

    Dear All
    How to use Element Pay value in Fast Formula
    Element Name: Transport_Allowance
    Input Values : Name Units User Enterable Database Item
    Pay Value Money No Yes
    Amount Money Yes Yes
    Balance Feeds : Value Name Balance Name Units
    Pay Value Transportation Amount Money
    Formula
    DEFAULT FOR ASG_SALARY IS 0
    DEFAULT FOR TRANSPORTATION_AMOUNT_ASG_RUN IS 0
    ALIAS ASG_SALARY AS Emp_Salary
    ALIAS TRANSPORTATION_AMOUNT_ASG_RUN AS Emp_Trans_Amt
    V_CALCULATED_SALARY = Emp_Salary + Emp_Trans_Amt
    RETURN V_CALCULATED_SALARY
    Using the above formula, I got only Basic Salary only
    How to get the Basic Salary + Transportation allowance in the return value
    Please help me..
    Thanks in advance

    Please check whether the priority of the element with which the fast formula is attached has a priority higher than the Transport_Allowance. If not then cahange the priority of the element to a prriority higher than Transport_Allowance.
    HTH

  • How to use Oracle database in CR XI R2!!!

    Hi All,
    I am having Oracle database in onsite machine.
    I need to design the report without DSN and installing Oracle in my machine.
    I dont know how to use connection String and Find DSN file option.
    Please anyone help me to solve the issue.
    Thanks in advance
    Saravanakumar.

    hI,
    Thank you for your reply.
    1. I tried to give connection string, but i couldnt succeed.
    2.If is give OLE(ODBC) I dono how the connection is established. Will it refer to TNSNAMES.ORA file, because it is simpy asking data source, use ID and password.
    it will be helpful if you clarify me on the doubts.
    Thank you,
    Saravanakumar.

  • How to use (Verify database) in DB13.

    Dear all,
    I tried to use (Verify database) in DB13 but it doesnt works. It says that the instance is up. HOw do I use this option in DB13.
    Thanx in advance.
    Lalit Rana

    Hello Lalit
    Please Try This
    For Update Stats - brconnect -u system/12345678  -c -f stats -t ALL
    For CheckDB - brconnect -u system/12345678 -c -f check
    For CleanuP - brconnect -u system/12345678 -c -f cleanup 
    system - your SAP System
    12345678 - Default Password
    please specify your operation system ( For Example if your O/S is Windows - 2003 Server then by Cmd level go to the oracle drive and run this command in command mode )
    For example - D: brconnect -u system/12345678 -c -f stats -t ALL
    Try It & See

  • How to use SSHRParams in a custom page

    Hi
    I have been trying to use SSHRParams in my custom page. I need to use this to get AssignmentId and PersonID. Initially I tried using the SSHRParam package by just importing it. But it did not help. Below is the code that I had in my controller
    import oracle.apps.fnd.common.VersionInfo;
    import oracle.apps.fnd.framework.webui.OAControllerImpl;
    import oracle.apps.fnd.framework.webui.OAPageContext;
    import oracle.apps.fnd.framework.webui.beans.OAWebBean;
    import oracle.apps.per.selfservice.arch.webui.PerOAControllerImpl;
    import oracle.apps.per.selfservice.common.SSHRParams;
    * Controller for ...
    public class PtoRequestDeleteCO extends PerOAControllerImpl
    public static final String RCS_ID="$Header$";
    public static final boolean RCS_ID_RECORDED =
    VersionInfo.recordClassVersion(RCS_ID, "%packagename%");
    * Layout and page setup logic for a region.
    * @param pageContext the current OA page context
    * @param webBean the web bean corresponding to the region
    public void processRequest(OAPageContext pageContext, OAWebBean webBean)
    super.processRequest(pageContext, webBean);
    SSHRParams localSSHRParams = new SSHRParams(pageContext.getRootApplicationModule());
    //localSSHRParams.initCtx();
    String personType = localSSHRParams.getSelectedPersonType();
    String personID = localSSHRParams.getSelectedPersonId();
    * Procedure to handle form submissions for form elements in
    * a region.
    * @param pageContext the current OA page context
    * @param webBean the web bean corresponding to the region
    public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
    super.processFormRequest(pageContext, webBean);
    I am new to OAF and I have tried almost everything that I can think of.
    Thanks
    Kumar
    Edited by: kvsankar on Feb 15, 2011 6:30 PM

    Here this is what you need to do
    1. get all the files from $PER_TOP/mds folder onto your pc.
    2. create folder structure called oracle/apps/per and put all the files from step1.
    3. zip above oracle folder and move it to jdevhome/jdev
    4. Attach this .zip file to the project by going into project properties -> libraries -> add libraries ( select the file in class path and source path example both these paths should be .../jdevhome/jdev/filename.zip)
    5. see my control code below ( remove any unnecessary code lines from below and use what u need, i am just pasting as is )
    package oracle.apps.pay.w4.webui;
    import java.io.Serializable;
    import oracle.apps.fnd.common.VersionInfo;
    import oracle.apps.fnd.framework.OAViewObject;
    import oracle.apps.fnd.framework.OAApplicationModule;
    import oracle.apps.fnd.framework.server.OADBTransactionImpl;
    import oracle.apps.fnd.framework.webui.OAWebBeanConstants;
    import oracle.apps.fnd.framework.webui.OAControllerImpl;
    import oracle.apps.fnd.framework.webui.OAPageContext;
    import oracle.apps.fnd.framework.webui.beans.OAWebBean;
    import oracle.apps.per.selfservice.common.SSHRParams;
    * Controller for ...
    public class W4mainCO extends OAControllerImpl
    public static final String RCS_ID="$Header$";
    public static final boolean RCS_ID_RECORDED =
    VersionInfo.recordClassVersion(RCS_ID, "%packagename%");
    * Layout and page setup logic for a region.
    * @param pageContext the current OA page context
    * @param webBean the web bean corresponding to the region
    public void processRequest(OAPageContext pageContext, OAWebBean webBean)
    super.processRequest(pageContext, webBean);
    OAApplicationModule oaapplicationmodule = pageContext.getRootApplicationModule();
    OADBTransactionImpl oadbtransactionimpl = (OADBTransactionImpl)oaapplicationmodule.getOADBTransaction();
    OAApplicationModule oaapplicationmodule1 = pageContext.getApplicationModule(webBean);
    OAViewObject oaviewobject = (OAViewObject)oaapplicationmodule1.findViewObject("W4VO1");
    SSHRParams sshrparams = new SSHRParams(pageContext.getApplicationModule(webBean).getOADBTransaction());
    String s = sshrparams.getPersonId();
    OAApplicationModule am = pageContext.getApplicationModule(webBean);
    Serializable[] parameters = { s };
    am.invokeMethod("initDetails", parameters);
    let me know if you need any help.
    Thanks
    Karan

  • How to use Resever Field for Customer Master

    Hi
    My Client Requirement. Price should be determine with Sales ORG, Distribution channel, Division, Districts, Talukas and Villages.
    But Talukas and villages are not available in SAP standard systems.
    Is it possible to use reserver field in Customer Master for this purpose?
    If it is ok then please give suggestion how to use this reserve fields.
    Thanks in Advance
    Madhu

    Hello,
    the system-behavior that you describe is standard behaviour, because   
    the fields which you are describe (village and ..) doesn't exist in structure KOMG.                                                                               
    For using this field in the field catalog you can proceed like this:   
    1. create a new field for example ZZvillage...                             
    2. add the new field in the table T681F for the application 'V' and the
       usage 'A'                                                           
    3. add the field to the include-structure KOMKAZ                       
    4. fill the new fields in the userexit for pricing                     
       (Pricing_Prepare_TKOMK (TKOMP)                                                                               
    I hope that the information are helpful for you.    
    regards
    Claudia

  • How to use I18N with a custom validator?

    This is my custom validator:
        public void validate(FacesContext context, UIComponent component, Object value) throws ValidatorException
            Pattern pat=Pattern.compile(".+@.+\\.[a-z]+");
            Matcher m= pat.matcher(value.toString());
            if(!m.find())
                FacesMessage message = new FacesMessage("Not a valid e-mail address");
                throw new ValidatorException(message);
        }Instead of providing the text "Not a valid e-mai address", I'd like to get the text out of my ApplicationResources property file.
    How can I do this?
    I know how to use it with the provided validators, but not with own custom ones
    Please help me out, thanks

    I found a solution for this problem, I don't know it's best practice but here it is :
        public void validate(FacesContext context, UIComponent component, Object value) throws ValidatorException
            String errortext;
            Pattern pat=Pattern.compile(".+@.+\\.[a-z]+");
            Matcher m= pat.matcher(value.toString());
            if(!m.find())
                ResourceBundle bundle =
                ResourceBundle.getBundle("be.vdab.resources.ApplicationResources", context.getViewRoot().getLocale());
                errortext = bundle.getString("erroremail");
                FacesMessage message = new FacesMessage(errortext);
                throw new ValidatorException(message);
        }

  • How to use getContent() method in custom JSP Provider to display a HTML Pag

    Hi,
    If anybody knows how to use getContent() method to use in custom jsp providers (developed by ourselves) so that it can be used to retrieve a jsp page (a simple html page) ..
    I want the code in the provider java file to for the getContent method...
    Pls. get back to me asap....if any body has implemented a custom jsp provider...as it's urgent...
    I have alreday placed the JSP file in the directory structure /etc/opt/SUNWps/desktop/default/channel_dir..But still the jsp is not being displayed..
    Pls get me the getContent() method code to retrive the JSP file..
    satyabrata

    Hi,
    You don't have to do anything in the custom JSPProvider's getContent method except the call {  return super.getContent(request,response); } . If all you want is just to show your jsp, then create a channel from the default JSPProvider, and edit the property contentPage of that channel from samplecontent.jsp to your jsp name, save the changes and login again. You should see your JSP.
    Sanjeev.

Maybe you are looking for

  • Creative Zen Vision:M 30gb LCD Broken (full of white stripes) (picture includ

    Hi. So I bought my player around christmas, so it has only been used for about a month. At that time it's been on a everyday use and it has been used to watch high quality videos daily. So about an hour ago I took it from my jacket's (inside) pocket

  • Cannot hide Rich Editor item onload via Dynamic Actions

    Hi, I have textarea and rich editor items that I have to show/hide vice versa based on select list item value. I have created Dynamic Actions to Show/Hide items on 'Cnange' event when value of select list: P23_FORMAT equals 1 True Actions: Show P23_T

  • Acrobat Catalog in 9 Pro Extended?

    I am currently using Acrobat 6.05. I use the Acrobat Catalog application built into Acrobat extensively, creating many large indexes of searchable pdf documents. I am unable to determine whether the Catalog application is available in the newest vers

  • Moving to OID, but...

    hi! currently i'm using the Oracle 9iAS and Portal (both Release 1) to: 1. develop pl/sql base applications. I make use of the local security tables (wwsec_person$ etc) to grant access to applications, content areas and folders etc. 2. a trigger that

  • CHECT and ZNME1 from PAYR table into FBL3N

    Hi Everybody, I've been asked to add CHECT and ZNME1 from PAYR table into FBL3N , I've checked in the add Special Field options but both are not available there (Only found CHECF but it's not the same as the needed one) . Is there an option to add th