Table design, best way?

I have two tables that describes a schedule. the first table contains:
table: Event
EventID
Time_stamp
Action
table: Event_units
EventID
UnitID
There are some events that need to be associated with multiple units.
I get the EventID from a sequence that I have created. Does anyone see any problems with this design or a better way to do it? The problem right now is I insert into the Events table first and the eventID is inserted by a trigger after the insert. Next I insert into the Event_units table. What I am worried about is that if another event is added to the Event table before I do the insert, eventID wont be right(see below). Is there any way when I do the insert that sequence I assigned to it is returned to my code?
INSERT INTO EVENT .. (app 1)
INSERT INTO EVENT .. (app 2)
INSERT INTO EVENT_UNITS .. (app 1)
null

Sure is! You can do it like this.
DECLARE
lv_Event_Id
BEGIN
INSERT INTO Event VALUES (sequence_name.nextval, SYSDATE, 'Big hoedown at the Buckley manor') RETURNING EventID INTO lv_Event_Id;
INSERT INTO Event_Units VALUES (lv_Event_Id, 5);
COMMIT;
END;
There you go! Returning is great sometimes. :)

Similar Messages

  • Servlet Design -- Best way to put it all together?

    Hi,
    I m currently beginning programming servlets and have built a number of individual servlets however now I wish to join them together, I find that Im a bit stuck with the best way to stick everything together.
    I m building a portal to interface with a web service. I have a servlet which submits a job to the web service, another servlet which gets the status of a job/all users jobs (and allows them to cancel/hold/release jobs) and another servlet to download the output files. I have an address of the scheduler which I wish to share between all of the servlets (so if one servlet finds the scheduler isnt there, it can call requerySchedd() to find the new Scheduler address). Is there a way to enable this object to be shared by all of the servlets?
    I was planning on having 2 individual pages for this portal
    1. A submission page.
    2. A status and results page.
    ----> note theres 2 different kinds of job which have different attributes and behaviours once submitted.
    How would I go about doing this is I have 3 servlets but only 2 (3 forms) pages, for example on page 2 , Would I be better splitting it up into more servlets and more html pages?
    Sorry if this a bit silly, but I d like some advice before I start something complicated or plain dumb.
    Many Thanks
    Nathan

    I agree with Tom. iBooks Author will be overkill for this and add unnecessary complications
    Unless all of your family have Macs, using Pages to create the document and then exporting to pdf will be most compatible and easy to use.
    Peter

  • Azure table design best practice

    What's the best practice for designing tables in Azure Tables to optimize query performance?

    Hi Raj,
    When we design the azure table, we need to consider the scalability of the azure table.
    and selecting the PartitionKey is very more important to scalability.
    Basically, we have two options which have their advantages and disadvantages:
    One Option: having a single partition by having the same value for PartitionKey for all entities to
    Second Option: having a unique value for PartitionKey for every entity
    More information about how to get the most out of windows azure tables ,please refer to the link below:
    http://blogs.msdn.com/b/windowsazurestorage/archive/2010/11/06/how-to-get-most-out-of-windows-azure-tables.aspx
    There is  also a detailed article which explain how to design a scalable partitioning strategy for Windows Azure Storage,please refer to the link below:
    http://msdn.microsoft.com/en-us/library/hh508997.aspx
    Best Regards,
    Kevin Shen

  • Best way to read and parse XML to multiple tables

    This is first time using XML input file for JDev ADF 10.1.3.3 application. We are trying to develop an XML API that the application will read and process. A simple XML record would have field tags for table AA which has 1 to many tags for table BB. Table BB contains 0 to many tags for tables: CC, DD, and EE. Naturnally, the database is relational and there exist Foreign Keys for the Master-Detail relationships that are represents as View Objects in the JDev application.
    What is the best way for us to design and code this API?

    Hi,
    I don't really see any better options for SharePoint. SharePoint use other production called 'Office Web App' to allow users to view/edit Microsoft Office documents (word, excel etc.). But the web version of excel doesn't support that much records as well
    as there's size limitations (probably the default max size is 10MB).
    Regarding second problem, I think you need some custom solutions (like a SharePoint timer job/webpart ) to read and present data.
    However, if you can reduce the excel file records to something near 16k (which is supported rows in web version of excel) then you can use SharePoint Excel service to refresh data automatically in the excel file in SharePoint from some external sources.
    Thanks,
    Sohel Rana
    http://ranaictiu-technicalblog.blogspot.com

  • Design question - best way to design a page for layout at runtime

    I have an application that I want to port to ADF faces. The application currently generates HTML for both the layout and for the data at runtime. All of the examples I have researched rely on a layout defined at design time, which will not work in my case as I have no way of knowing exactly what the layout will be until runtime.
    My question is what is the best way to use ADF faces to dynamically build a web page where the page layout can not be known at design time, only at runtime. Is there a way to build the component tree that will generate the HTML at runtime?
    Here are the specifics:
    I have an existing application that generates repeating sections of HTML for a user view -- a set of step by step instructions. Each step in the instructions contains one or more of the following elements
    - a heading
    - some text
    - a table with text in the table cells
    There can be one or more steps in a document. Some documents will have a few steps, some will have many steps.
    I am looking for the best way to generate the repeating HTML steps in a single HTML document.
    One idea: can I use a fragment for each step and bind to the data at rutime? If this works, how would I create an iterator or loop that would be able to include the fragment n times to render a single HTML view showing the sequence of all steps?

    Thanks for the suggestions, still don't have a good strategy, however.
    What I am really trying to do here is to generate HTML at runtime. This is easy to do with servlets and or jsp, it looks like it is very difficult or impossible with ADF Faces. Using Java EE technologies, I simply include or exclude the HTML markup as an output of my servlet or jsp. I can use JSTL and a backing bean to do most of this. Unfortunately, in ADF faces, it seems that all controls are defined at design time in XML. Editing the XML files at runtime does not seem to be a logical approach. I have tried adding some controls in the backing bean at runtime, and got them to render. However, I also got an el error at runtime, indicating that the framework cannot find the accessor methods, which of course makes sense, as they don't exist in the backing bean. I don't really see any way to effectively modify the backing bean to accommodate this use case.
    Interestingly, a coworker is using .Net to do a similar project. In this project we want to print labels using convention instead of configuration. In the convention, we have a data object that contains named fields. We try to match up the field name in a label template with the field name in the data structure, using reflection. Any fields that cannot be matched up end up as input text boxes with associated prompts. Since we cannot know how many fields will match up at design time, we dynamically build a web page containing one or more text inputs for the user to enter data that cannot be pulled from our data structure. We return this page to the user for data input. In short, using .Net we can create a single tool that can be used to print any current or future label our users may want to create. Apparently, .Net can do this quite easily.
    This is a somewhat common approach, that I have used in a number of businesses. Did Oracle really miss this use case with ADF Faces, or is there some way to approach these types of problems?
    Thanks,
    Steve

  • Best way for Java objects to relate to DB tables

    When creating a Java app which relies on a backend DB, it is convenient (and necessary) to create Java classes which relate to the data in those tables. However with a normalised set of tables, should the Java classes relate purely to the tables, or the "view" of the un-normalised data?
    e.g. (rough example of what I mean)
    CREATE TABLE teams
    team_id INTEGER NOT NULL PRIMARY KEY,
    team_name CHAR(50)
    CREATE TABLE users
    user_id INTEGER NOT NULL PRIMARY KEY,
    user_name CHAR(50),
    team_id INTEGER REFERENCES teams(team_id)
    Now, the Java class for a user could have either have a variable (e.g. teamName) declared as an int (to fully reflect the table design) or a String (to represent the "view" of the data). I know that views can be used etc. and in this example that would be very easy � I am just using these simplified tables as an example.
    I have tried both and both have pitfalls. For instance, when getting the data from the database, it is very easy to create the object from the DB if it reflects the �view� of the data. However when it comes to updating the data in the DB, you need to do a lot of other work to find out what needs updating in which tables, because the actual raw data (as will be inserted/updated with SQL commands) is not available in the Java object.
    I hope this makes sense.
    Thanks.

    My question is what is the best way to write the classes that represent the DB data. As I said this is not EJB (that would handle the DB side of things anyway), as this is overkill for this particular situation. It was more of a general question anyway - should the class contain the actual data (e.g. should the user Class contain a String for the team name (e.g. Purchasing) or a link to the underlying DB id for Purchasing.
    In reality, I would create a Team class, but the same applies - should the Java Class ever contain any relationship to the underlying DB. I think not, but it seems inefficient to have to continually query the DB to find out information we already have.
    Apologies if I am not explaining this very well.

  • What is the best way to drop and recreate a Primary Key in the Replication Table?

    I have a requirement to drop and recreate a primary key in a table which is part of Transaction replication. What is the best way to fo it other than remove it from replication and add again?
    Thanks
    Swapna

    Hi Swapna,
    Unfortunately you cannot drop columns used in a primary key from articles in transactional replication.  This is covered in
    Make Schema Changes on Publication Databases:
    You cannot drop columns used in a primary key from articles in transactional publications, because they are used by replication.
    You will need to drop the article from the publication, drop and recreate the primary key, and add the article back into the publication.
    To avoid having to send a snapshot down to the subscriber(s), you could specify the option 'replication support only' for the subscription.  This would require the primary key be modified at the subscriber as well prior to adding the article back in
    and should be done during a maintenance window when no activity is occurring on the published tables.
    I suggest testing this out in your test environment first, prior to deploying to production.
    Brandon Williams (blog |
    linkedin)

  • Best way to set up a custom table using dates ytd, quarters, months

    Hello-
    I did post this on the crystal forum however it really involves setting up a good structured table in order to get the data to report on which I think we need to change which is why I'm posting here.
    I am not a dba but I work with crystal reports and we are working together to get data in tables that we can report on.  We are in the process of creating a data warehouse, which will mainly be summarized data we are exporting out of our legacy system and importing into a mysql database.  Most of this data will be summarized by month, quarter and year.  We will have multiple years of data.  A lot of the reports we will be creating will be in a comparison manner such as 2009 vs 2008 or Jan this year compared to Jan last year or list out sales by month Jan-Dec 2009.  I would like this data to be easily displayed on a report in a side by side manner.  To get this result, what is the best way to structure the data in the tables on a monthly, quarterly and yearly basis?  Right now weu2019ve got one field in the table called date (which is a string) which is listed like:
    Date
    2008YTD
    2009YTD
    2009Jan
    2008Jan
    Is it best to break out the date information so that on the report side it will be easier to work with?  Also should this be set up in the table as a date instead of a string?  If so how do you account for a YTD date?  Are we going to need 2 dates, a start and end date to achieve ytd or qtd information?  Do you recommend creating just a date table and if so how would that be structured?
    So for reporting purposes, using crystal reports, I would like to display comparison data on a report side by side, for this example this year goals compared to last years goals by goal code A-Z (which is a credit code, goals are for the # of credits by code for the year).  The end result I would like is to look like this:
    code   2009 goal   2008 goal
    A        25              20
    B        50              60
    C        10              15
    However the data looks like this (displaying all of the 2009 data first then the 2008 data, not side by side which is how it is in the table):
    code   2009 goal   2008 goal
    A        25
    B        50
    C        10
    etc to Z
    A                          20
    B                          60
    C                          15
    Right now the data is structured in the table like:
    Code  Goal  Date (this is currently a string in the db)
    A        25     YTD 2009
    B        50     YTD 2009
    etc. A-Z for 2009 then:
    A        20      YTD 2008
    B        60      YTD 2008
    Any thoughts on strucuting a table would be appreciated.  thanks.

    Jennifer,
    Most of the DW examples I've seen use a dimDateTime table in the database. That table has multiple columns related to the specific time... For example, here are the columns that are in the, SQL Server sample database, "AdventureWorkdDW"... "DimTime" table
    COLUMN_NAME             COLUMN_INFO
    TimeKey               (int, not null)
    FullDateAlternateKey     (datetime, null)
    DayNumberOfWeek          (tinyint, null)
    EnglishDayNameOfWeek     (nvarchar(10), null)
    SpanishDayNameOfWeek    (nvarchar(10), null)
    FrenchDayNameOfWeek     (nvarchar(10), null)
    DayNumberOfMonth     (tinyint, null)
    DayNumberOfYear          (smallint, null)
    WeekNumberOfYear     (tinyint, null)
    EnglishMonthName     (nvarchar(10), null)
    SpanishMonthName     (nvarchar(10), null)
    FrenchMonthName          (nvarchar(10), null)
    MonthNumberOfYear     (tinyint, null)
    CalendarQuarter          (tinyint, null)
    CalendarYear          (char(4), null)
    CalendarSemester     (tinyint, null)
    FiscalQuarter          tinyint, null)
    FiscalYear          (char(4), null)
    FiscalSemester          (tinyint, null)
    Then all of the fact table receive their date stamps by linking back to this table, using the TimeKey as a foreign key.
    HTH,
    Jason

  • How is the best way to manage the stats table?

    Hello!
    I have the Integration 2.1 working with an Oracle 8.1.7 db. I noticed that the table
    STATS is growing pretty fast.
    How is the best way to manage this table?... I haven't found something related with
    this issue in the documentation, but at least I want to know how to safely delete
    records from this table.
    For example, if I know the minimal time I have to keep in the table, is quite simple
    to create a shell script and/or Oracle pl/sql job to trim the table.
    I hope somebody can help me!!!!
    Thank you!
    Ulises Sandoval

    Write an app people want to buy and rate highly.

  • What is the best way to implement default values stored in a DB table?

    [JHeadstart 10.1.3 build 78]
    [JDeveloper 10.1.3 SU4]
    We are struggling on how to best implement default values that are stored in a DB table. What we have is a database table with (CODE_TYPE, TABLE_NAME, COLUMN_NAME, DEFAULT_VALUE) as columns. This way the application administrator can administer default values himself/herself. Now we need to find the best way to set these table supplied default values in new rows. Globally we are aware of two ways:
    - override create() method on VO
    - probably create a View Object on top of the database table with default values (we are capable of transposing the table and return exactly one row with a column for each default value) and use JHeadstarts item property 'Default Value'.
    We prefer the latter, since this is more declarative, however we struggle with the EL expression needed to indicate the default value.
    If we have a VO named "DefaultValues" with a SELECT on a view on top of our database table (transposed) returning exactly one row, let us say:
    SELECT orglanguage, orgtype, orgstatus [...]
    FROM v_default_values
    --> returning exactly one row
    and we want an EL expression on an item that needs the value from orglanguage. What will the EL expression be? Something like:
    #{data.DefaultValuesPageDef.currentrow.orglanguage.inputValue}? We tried several things but they do not work. A static default value works, but every EL expression so far does not. We know that using "data" can be dangerous, but thought JHeadstart takes care of preparing the other Page Definitions, so it might be possible when you use JHeadstart.
    Or is overriding the create() method the preferred way? Or do we have to look at a Managed Bean for our default values that we refer to from EL (let us say MyAppDefaultValuesBean) and in that case: how do you associate a Managed Bean with a VO?
    Any help would be appreciated. Apart from these default values, things are going rather well in this first J2EE/JHS project for us!
    Toine

    Steven,
    Thanks for the reply. Unfortunately whatever we try, we cannot get it to work. We started looking at the second option (since we do need default values also in table lay-out new rows). We created a DefaultValues ViewObject, added it to the Application Module, added an EL expressiona to the Default Display Value property (replacing your ending ")" with a "}" offcourse ;-)), ran the JAG so that a page definition was generated for DefaultValues and we managed to get it prepared when loading for example the Organisation's jspx page. However no default value appears in a new row (not in Form, not in Table layout).
    I then created a quick application on top of the HR schema, added a DefaultValues ViewObject using one calculated attribute (set Salary fixed to 1000), added the EL expression to the Salary Default Display Value property in the Employees Group, made sure the DefaultValuesPageDef is prepared by adding it to the parameter section and I see it getting prepared. I also see a managed Bean is created in the Employees-bean.xml.
    In the Embedded OC4J log we see:
    16:01:01 DEBUG (JhsPageLifecycle) -executing onCreate
    16:01:01 DEBUG (JhsPageLifecycle) -CreateEmployeesDefaultValues bean found, applying default values to new row
    2006-08-02 16:01:01.825 WARNING [ADFc] Warning: No Method onCreateEmployees and no actionBinding CreateEmployees found.
    Is it this warning we should be worried about? Since no default value is created.
    The managed bean (Employees-beans.xml) looks like:
    <?xml version="1.0" encoding="windows-1252"?>
    <!DOCTYPE faces-config PUBLIC
    "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
    "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
    <faces-config xmlns="http://java.sun.com/JSF/Configuration">
    <managed-bean>
    <managed-bean-name>CreateEmployeesDefaultValues</managed-bean-name>
    <managed-bean-class>oracle.jheadstart.controller.jsf.bean.DefaultValuesBean</managed-bean-class>
    <managed-bean-scope>request</managed-bean-scope>
    <managed-property>
    <property-name>iteratorBinding</property-name>
    <value>#{bindings.EmployeesIterator}</value>
    </managed-property>
    <managed-property>
    <property-name>defaultValues</property-name>
    <map-entries>
    <map-entry>
    <key>Salary</key>
    <value>#{data.DefaultValuesPageDef.DefaultValuesIterator.currentRow.Salary}</value>
    </map-entry>
    </map-entries>
    </managed-property>
    <managed-property>
    <property-name>actionResult</property-name>
    <value>CreateEmployees</value>
    </managed-property>
    </managed-bean>
    <managed-bean>
    <managed-bean-name>searchEmployees</managed-bean-name>
    <managed-bean-class>oracle.jheadstart.controller.jsf.bean.JhsSearchBean</managed-bean-class>
    <managed-bean-scope>session</managed-bean-scope>
    <managed-property>
    <property-name>bindings</property-name>
    <value>#{data.EmployeesPageDef}</value>
    </managed-property>
    <managed-property>
    <property-name>searchBinding</property-name>
    <value>#{data.EmployeesPageDef.advancedSearchEmployees}</value>
    </managed-property>
    <managed-property>
    <property-name>searchAttribute</property-name>
    <value>EmployeeId</value>
    </managed-property>
    <managed-property>
    <property-name>dataCollection</property-name>
    <value>EmployeesView1</value>
    </managed-property>
    <managed-property>
    <property-name>autoquery</property-name>
    <value>true</value>
    </managed-property>
    </managed-bean>
    <managed-bean>
    <managed-bean-name>EmployeesCollectionModel</managed-bean-name>
    <managed-bean-class>oracle.jheadstart.controller.jsf.bean.JhsCollectionModel</managed-bean-class>
    <managed-bean-scope>request</managed-bean-scope>
    <managed-property>
    <property-name>jhsPageLifecycle</property-name>
    <value>#{jhsPageLifecycle}</value>
    </managed-property>
    <managed-property>
    <property-name>bindings</property-name>
    <value>#{bindings}</value>
    </managed-property>
    <managed-property>
    <property-name>rangeBinding</property-name>
    <value>#{bindings.EmployeesTable}</value>
    </managed-property>
    <managed-property>
    <property-name>defaultValues</property-name>
    <value>#{CreateEmployeesDefaultValues.defaultValues}</value>
    </managed-property>
    </managed-bean>
    </faces-config>
    This is the DefaultValues.xml:
    <?xml version='1.0' encoding='windows-1252' ?>
    <!DOCTYPE ViewObject SYSTEM "jbo_03_01.dtd">
    <ViewObject
    Name="DefaultValues"
    BindingStyle="OracleName"
    CustomQuery="true"
    ComponentClass="hr.model.DefaultValuesImpl"
    UseGlueCode="false" >
    <DesignTime>
    <Attr Name="_version" Value="10.1.3.36.73" />
    <Attr Name="_codeGenFlag2" Value="Access|Coll|VarAccess" />
    </DesignTime>
    <ViewAttribute
    Name="Salary"
    IsUpdateable="false"
    IsPersistent="false"
    Precision="255"
    Type="java.lang.String"
    ColumnType="VARCHAR2"
    AliasName="SALARY"
    Expression="1000"
    SQLType="VARCHAR" >
    </ViewAttribute>
    </ViewObject>
    The PageDef for Defaultvalues is like:
    <?xml version="1.0" encoding="UTF-8" ?>
    <pageDefinition xmlns="http://xmlns.oracle.com/adfm/uimodel"
    version="10.1.3.36.73" id="DefaultValuesPageDef"
    Package="hr.view.pagedefs" EnableTokenValidation="false">
    <parameters/>
    <executables>
    <iterator id="DefaultValuesIterator"
    Binds="AppModuleDataControl.DefaultValues1"
    DataControl="AppModuleDataControl" RangeSize="10"/>
    </executables>
    <bindings>
    <attributeValues id="DefaultValuesSalary"
    IterBinding="DefaultValuesIterator">
    <AttrNames>
    <Item Value="Salary"/>
    </AttrNames>
    </attributeValues>
    <table id="DefaultValuesTable" IterBinding="DefaultValuesIterator">
    <AttrNames>
    <Item Value="Salary"/>
    </AttrNames>
    </table>
    <action id="FirstDefaultValues" IterBinding="DefaultValuesIterator"
    DataControl="AppModuleDataControl" RequiresUpdateModel="true"
    Action="12"/>
    <action id="PreviousDefaultValues" IterBinding="DefaultValuesIterator"
    DataControl="AppModuleDataControl" RequiresUpdateModel="true"
    Action="11"/>
    <action id="NextDefaultValues" IterBinding="DefaultValuesIterator"
    DataControl="AppModuleDataControl" RequiresUpdateModel="true"
    Action="10"/>
    <action id="LastDefaultValues" IterBinding="DefaultValuesIterator"
    DataControl="AppModuleDataControl" RequiresUpdateModel="true"
    Action="13"/>
    <methodAction RequiresUpdateModel="true" Action="999"
    id="advancedSearchDefaultValues"
    IterBinding="DefaultValuesIterator"
    DataControl="AppModuleDataControl"
    InstanceName="AppModuleDataControl.dataProvider"
    MethodName="advancedSearch"
    ReturnName="AppModuleDataControl.methodResults.AppModuleDataControl_dataProvider_advancedSearch_result"
    IsViewObjectMethod="false">
    <NamedData NDName="viewObjectUsage"
    NDValue="#{searchDefaultValues.dataCollection}"
    NDType="java.lang.String"/>
    <NamedData NDName="arguments" NDValue="#{searchDefaultValues.arguments}"
    NDType="java.util.ArrayList"/>
    <NamedData NDName="allConditionsMet"
    NDValue="#{searchDefaultValues.allConditionsMet}"
    NDType="java.lang.Boolean"/>
    </methodAction>
    <action id="setCurrentRowWithKeyDefaultValues"
    IterBinding="DefaultValuesIterator"
    InstanceName="AppModuleDataControl.DefaultValues1"
    DataControl="AppModuleDataControl" RequiresUpdateModel="false"
    Action="96">
    <NamedData NDName="rowKeyStr" NDValue="#{row.rowKeyStr}"
    NDType="java.lang.String"/>
    </action>
    <action id="CreateDefaultValues" IterBinding="DefaultValuesIterator"
    DataControl="AppModuleDataControl" RequiresUpdateModel="true"
    Action="40"/>
    <action id="DeleteDefaultValues" IterBinding="DefaultValuesIterator"
    DataControl="AppModuleDataControl" RequiresUpdateModel="false"
    Action="30"/>
    <action id="Commit" RequiresUpdateModel="true" Action="100"
    DataControl="AppModuleDataControl"/>
    <action id="Rollback" RequiresUpdateModel="false" Action="101"
    DataControl="AppModuleDataControl"/>
    </bindings>
    </pageDefinition>
    We do not understand what is wrong and why the default values do not get created in the new rows (and it is taking us far too much time). Any chance the EL expression is still wrong? It is a shame that any syntax errors in EL expressions are not visible in some logfile. It looks like when EL expressions are wrong, they are ignored instead of raising an error...
    Toine

  • What's the best way to create XML file with a schema from a database table?

    Hi,
    I want to create an XML file from a database table (which has over 600 columns) using XML schema (.xsd file). I want to know the best way to do this.
    The output XML file is NOT a direct data dump from the DB table, there�re some logic around it, such as the XML file has some hierarchy with repeating tags.
    I have done this using JAXB by creating Java classes form XML schema, but I don�t want to map 600 DB columns to these Java classes manually, and loop through the record set to create repeating tags.
    I know there are few tools around now like MapForce (Altova), how do people do these now?
    Thanks,
    Chandi

    Can you use a schema when we compose XML doc from Database tables?
    Actually, I'm using SQL Server (sorry, wrong forum). But, I thought a Java tool would have a solution for me.

  • What is the best way to use Swing GUIs in an MVC design?

    I have a question on how to build an application using swing frames for the UI, but using an MVC architecture. I've checked the rest of the forum, but not found an answer to my question that meets my needs.
    My application at this stage presents a login screen to get the userid and password, or to allow the user to choose a new locale. If an Enter action is performed, the userid and password are checked against the DB. If not accepted, the screen is repainted with a "try-again" message. If the Cancel action is performed, the process stops. If a locale action is performed, the screen is repainted with different langauge labels. Once the login process is passed, a front screen (another swing frame) is presented.
    Implementation: I am using a session object (Session, represents the user logging in) that calls the Login screen (LoginGUI, a Swing JFrame object with various components). Session uses setters in LoginGUI to set the labels, initial field entries etc, before enabling the screen. From this point, the user will do something with the LoginGUI screen - could be closing the window, entering a mix of userid and password, or maybe specifying a locale. Once the user has taken the action, if required, the session object can use getters to retrieve the userid and password values entered in the fields.
    The crux of the problem is 1) how will Session know that an action has been taken on the LoginGUI, and 2) how to tell what action has been taken.
    This could be solved by getting LoginGUI to call back to Session, however, I am trying to buid the application with a good separation of business, logic and presentation (i.e MVC, but not using any specific model). Therefore, I do not want LoginGUI to contain any program flow logic - that should all be contained in Session.
    I am aware of two possible ways to do this:
    1. Make LoginGUI synchronised, so that Session waits for LoginGUI to send a NotifyAll(). LoginGUI could hold a variable indicating what has happened which Session could interrogate.
    2. Implement Window Listener on Session so that it gets informed of the Window Close action. For the other two actions I could use a PropertyChangeListener in Session, that is notified when some variable in LoginGUI is changed. This variable could contain the action performed.
    Has anyone got any comments on the merits of these methods, or perhaps a better method? This technique seems fundamental to any application that interfaces with end-users, so I would like to find the best way.
    Thanks in advance.

    Hi,
    I tried to avoid putting in specific code as my question was more on design, and I wanted to save people having to trawl through specific code. And if I had any school assignments outstanding they would be about 20 years too late :-). I'm not sure computers more sophisticated than an abacus were around then...
    Rather than putting the actual code (which is long and refers to other objects not relevant to the discussion), I have put together two demo classes to illustrate my query. Comments in the code indicate where I have left out non-relevant code.
    Sessiondemo has the main class. When run, it creates an instance of LoginGUIdemo, containing a userid field, password field, a ComboBox (which would normally have a list of available locales), an Enter and a Cancel box.
    When the Locale combo box is clicked, the LoginGUIdemo.userAction button is changed (using an ActionListener) and a property change is fired to Session (which could then perform some work). The same technique is used to detect Enter events (pressing return in password and userid, or clicking on Enter), and to detect Cancel events (clicking on the cancel button). Instead of putting in business code I have just put in System.out.printlns to print the userAction value.
    With this structure, LoginGUIdemo has no business logic, but just alerts Sessiondemo (the class with the business logic).
    Do you know any more elegant way to achieve this function? In my original post, I mentioned that I have also achieved this using thread synchronisation (Sessiondemo waits on LoginGUI to issue a NotifyAll() before it can retrieve the LoginGUI values). I can put together demo code if you would like. Can you post any other demo code to demonstrate a better technique?
    Cheers,
    Alan
    Here's Sessiondemo.class
    import java.io.*;
    import java.awt.event.*;
    import java.util.*;
    import java.beans.*;
    public class Sessiondemo implements PropertyChangeListener {
        private LoginGUIdemo lgui;   // Login screen
        private int localeIndex; // index referring to an array of available Locales
        public Sessiondemo () {
            lgui = new LoginGUIdemo();
            lgui.addPropertyChangeListener(this);
            lgui.show();
        public static void main(String[] args) {
            Sessiondemo sess = new Sessiondemo();
        public void propertyChange(java.beans.PropertyChangeEvent pce) {
            // Get the userAction value from LoginGUI
            String userAction = pce.getNewValue().toString();
            if (userAction == "Cancelled") {
                System.out.println(userAction);
                // close the screen down
                lgui.dispose();
                System.exit(0);
            } else if (userAction == "LocaleChange") {
                System.out.println(userAction);
                // Get the new locale setting from the LoginGUI
                // ...modify LoginGUI labels with new labels from ResourceBundle
    lgui.show();
    } else if (userAction == "Submitted") {
    System.out.println(userAction);
    // ...Get the userid and password values from LoginGUIdemo
                // run some business logic to decide whether to show the login screen again
                // or accept the login and present the application frontscreen
    }And here's LoginGUIdemo.class
    * LoginGUIdemox.java
    * Created on 29 November 2002, 18:59
    * @author  administrator
    import java.beans.*;
    public class LoginGUIdemo extends javax.swing.JFrame {
        private String userAction;
        private PropertyChangeSupport pcs;
        /** Creates new form LoginGUIdemox */
        // Note that in the full code there are setters and getters to allow access to the
        // components in the screen. For clarity they are not included here
        public LoginGUIdemo() {
            pcs = new PropertyChangeSupport(this);
            userAction = "";
            initComponents();
        public void setUserAction(String s) {
            userAction = s;
            pcs.firePropertyChange("userAction",null,userAction);
        public void addPropertyChangeListener(PropertyChangeListener l) {
            pcs.addPropertyChangeListener(l);
        public void removePropertyChangeListener(PropertyChangeListener l) {
            pcs.removePropertyChangeListener(l);
        /** This method is called from within the constructor to
         * initialize the form.
         * WARNING: Do NOT modify this code. The content of this method is
         * always regenerated by the Form Editor.
        private void initComponents() {
            jTextField1 = new javax.swing.JTextField();
            jTextField2 = new javax.swing.JTextField();
            jComboBox1 = new javax.swing.JComboBox();
            jButton1 = new javax.swing.JButton();
            jButton2 = new javax.swing.JButton();
            getContentPane().setLayout(new java.awt.FlowLayout());
            addWindowListener(new java.awt.event.WindowAdapter() {
                public void windowClosing(java.awt.event.WindowEvent evt) {
                    exitForm(evt);
            jTextField1.setText("userid");
            jTextField1.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    EnterActionPerformed(evt);
            getContentPane().add(jTextField1);
            jTextField2.setText("password");
            jTextField2.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    EnterActionPerformed(evt);
            getContentPane().add(jTextField2);
            jComboBox1.setToolTipText("Select Locale");
            jComboBox1.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    LocaleActionPerformed(evt);
            getContentPane().add(jComboBox1);
            jButton1.setText("Enter");
            jButton1.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    EnterActionPerformed(evt);
            getContentPane().add(jButton1);
            jButton2.setText("Cancel");
            jButton2.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    CancelActionPerformed(evt);
            getContentPane().add(jButton2);
            pack();
        private void LocaleActionPerformed(java.awt.event.ActionEvent evt) {
            setUserAction("LocaleChange");
        private void CancelActionPerformed(java.awt.event.ActionEvent evt) {
            setUserAction("Cancelled");
        private void EnterActionPerformed(java.awt.event.ActionEvent evt) {
            setUserAction("Submitted");
        /** Exit the Application */
        private void exitForm(java.awt.event.WindowEvent evt) {
            System.exit(0);
         * @param args the command line arguments
        public static void main(String args[]) {
            new LoginGUIdemo().show();
        // Variables declaration - do not modify
        private javax.swing.JTextField jTextField2;
        private javax.swing.JTextField jTextField1;
        private javax.swing.JComboBox jComboBox1;
        private javax.swing.JButton jButton2;
        private javax.swing.JButton jButton1;
        // End of variables declaration

  • Best way to remove duplicates based on multiple tables

    Hi,
    I have a mechanism which loads flat files into multiple tables (can be up to 6 different tables) using external tables.
    Whenever a new file arrives, I need to insert duplicate rows to a side table, but the duplicate rows are to be searched in all 6 tables according to a given set of columns which exist in all of them.
    In the SQL Server Version of the same mechanism (which i'm migrating to Oracle) it uses an additional "UNIQUE" table with only 2 columns(Checksum1, Checksum2) which hold the checksum values of 2 different sets of columns per inserted record. when a new file arrives it computes these 2 checksums for every record and look it up in the unique table to avoid searching all the different tables.
    We know that working with checksums is not bulletproof but with those sets of fields it seems to work.
    My questions are:
    should I use the same checksums mechanism? if so, should I use the owa_opt_lock.checksum function to calculate the checksums?
    Or should I look for duplicates in all tables one after the other (indexing some of the columns we check for duplicates with)?
    Note:
    These tables are partitioned with day partitions and can be very large.
    Any advice would be welcome.
    Thanks.

    >
    I need to keep duplicate rows in a side table and not load them into table1...table6
    >
    Does that mean that you don't want ANY row if it has a duplicate on your 6 columns?
    Let's say I have six records that have identical values for your 6 columns. One record meets the condition for table1, one for table2 and so on.
    Do you want to keep one of these records and put the other 5 in the side table? If so, which one should be kept?
    Or do you want all 6 records put in the side table?
    You could delete the duplicates from the temp table as the first step. Or better
    1. add a new column WHICH_TABLE NUMBER to the temp table
    2. update the new column to -1 for records that are dups.
    3. update the new column (might be done with one query) to set the table number based on the conditions for each table
    4. INSERT INTO TABLE1 SELECT * FROM TEMP_TABLE WHERE WHICH_TABLE = 1
    INSERT INTO TABLE6 SELECT * FROM TEMP_TABLE WHERE WHICH_TABLE = 6
    When you are done the WHICH_TABLE will be flagged with
    1. NULL if a record was not a DUP but was not inserted into any of your tables - possible error record to examine
    2. -1 if a record was a DUP
    3. 1 - if the record went to table 1 (2 for table 2 and so on)
    This 'flag and then select' approach is more performant than deleting records after each select. Especially if the flagging can be done in one pass (full table scan).
    See this other thread (or many, many others on the net) from today for how to find and remove duplicates
    Best way of removing duplicates

  • Best way to import data to multiple tables in oracle d.b from sql server

    HI All am newbie to Oracle,
    What is the Best way to import data to multiple tables in Oracle Data base from sql server?
    1)linked server?
    2)ssis ?
    If possible share me the query to done this task using Linked server?
    Regards,
    KoteRavindra.

    check:
    http://www.mssqltips.com/sqlservertip/2011/export-sql-server-data-to-oracle-using-ssis/
          koteravindra     
    Handle:      koteravindra 
    Status Level:      Newbie
    Registered:      Jan 9, 2013
    Total Posts:      4
    Total Questions:      3 (3 unresolved)
    why so many unresolved questions? Remember to close your threads marking them as answered.

  • Best way to deal with Mutating table exception with Row Level Triggers

    Hello,
    It seems to be that the best way to deal with Mutating Table exception(s) is to have to put all the trigger code in a package & use it in conjunction with a Statement level trigger .
    This sounds quite cumbersome to me . I wonder is there any alternative to dealing with Mutating table exceptions ?
    With Regards

    AskTom has a good article about this,
    http://asktom.oracle.com/tkyte/Mutate/index.html

Maybe you are looking for

  • How do I send from different email address

    I would like to use a clients email address when I send out thier survey form.  It is more recognizable and less likely to get caught is spam filter compared to using my email address.

  • How to publish Animation in html 5 with flash CC

    Hi I am using Flash CC trial version and want to export AS3 animations in HTML5. I have gone through this tutorial : https://tv.adobe.com/watch/learn-flash-professional-cc/export-the-project-for-the-web-ipad -and-more/ and tried in Flash CC was shown

  • Multi Display

    Hi, i need advices about following: i have a Frame class on a server machine. my application need to display this frame on to a client machine. For the moment i used RMI to do that. But the pb is: When the client click on a button for example, i woul

  • Do you have to buy the nike plus app for nike plus to work

    Do have to buy the nike plus app

  • Flash Player Drive on Desktop?

    Hi, After the most recent round of updates for Safari (which forces you to update Adobe Flash Player) I have had to download flash again. After download, a hard drive type icon with "Adobe Flash Player" appears on my desktop and, in "Finder" it shows