How to specify an initial value for a sequence? (using LPD)

I tried to come up with a piece of code that initialize the sequences defined in the annotations in my persistent classes, without success. According to the documentation I could find, I thought the following might work:

' public void initSequence (String sequenceName, String svalue) {}
SequenceConfig sequenceConfig = null;
try {}
sequenceConfig = m_store.getSequenceConfig (sequenceName);
sequenceConfig.setInitialValue (Long.parseLong (svalue));
m_store.setSequenceConfig (sequenceName, sequenceConfig);
System.out.println ("initialized correctly the sequence:" + sequenceName);
} catch (IllegalStateException e) {}
ignore; the sequence had already been opened
}

} (where m_store is an instance of EntityStore)

Until this method is called, all my primary and secondary indexes created as in:

m_linkIndex = m_store.getPrimaryIndex (Integer.class, Class1.class);
etc.

And my classes to resemble the following:
@Entity
public class Class1 {}

@SecondaryKey(relate=MANY_TO_ONE)
private String m_contentUrl;

private String m_creatorId;

@PrimaryKey (sequence = "linkID")
private int m_key;

etc.
}

Problem: when I run the method "initSequence" with the appropriate settings (for example, "linkID", '10000000'), it has no apparent effect on the values of the sequence uses. In fact, the sequence starts at number 1 :-(.

Could someone explain what that is I am doing wrong? (assuming that the software is not bug). I use version
3.3.69. thanks in advance!

Sorry, you are right.

Until this method is called, all my primary and secondary indexes created as in:

The problem is maybe that you configure the order after you open the index. The configuration of the sequence (and database) must take place before the opening of the index.

-mark

Tags: Database

Similar Questions

  • How to set the initial value for a single radiobutton in a group of Radio buttons

    Hi all

    I have a radiogroup with 3 buttons. The names of the RadioGroup are driven out of a XXVO.

    3 Radion buttons:

    + 9
    * XX
    * XXX

    When loading the Page I want to make an XXX option button to be the default, please suggest how.

    Note: The radiobutton values come from VO

    Thank you

    Hello

    XXCONTACT_ADDR_BUTTON1 - is the value of the radio button to select the right...

    Very well.. :))

    Concerning
    Meher Irk

  • How to go from sysdate as the initial value for reports?

    Hi, I am using Oracle 10 G reports. I would like to know how to pass sysdate as initial value for the property of a date in the parameter element user. Help, please. Thank you

    arms777 wrote:
    I want to say is, if you select range of property for the specific parameter, there is a property for the initial value (type of data, width, mask entry, initial value, Validation trigger, list of values, etc.). Does this mean that I can just put sysdate on the initial value of the parameter property? I really need to use a trigger for this? In forms, I don't have to create a trigger to do this, simply put sysdate on the initial value of the item property. I hope you understand what I mean. Thanks again.

    I can't find another way...

    This from Reports FAQ
    How to set the initial values of the parameters to the form of the parameter at run time? +

    This is what is mainly used for BeforeForm relaxation. Even if you used a select statement to create a search list for the parameter, this statement is completely parsed before the form parameter is opened. Simply assign the parameter to a value in the trigger BeforeForm will choose this option as a default value displayed to the user. For example, suppose you have a parameter called p_input_date that is intended to contain a date of the invoice. The following example will select the date of the most recent invoice being the default and notes that it correctly handle exceptions to ensure that the report does not arbitrarily die if this default setting fails. Also note that, as all the triggers of report, it should return a true or false value.

    function BeforePForm return boolean is
    begin
    select max(bill_period_end_date + 1)
      into :p_input_date
      from billing_period
     where bill_period_end_date <= (select trunc(sysdate)
                                      from dual);
      return (TRUE);
    exception
      when others then
         :p_input_date := null;
         return true;
    end;
    

    If someone useful or appropriate, please mark accordingly.

  • How can you specify the default value for the undefined array elements

    According to aid LV, the tables have two default values, the normal default value and the default value for the undefined array elements.

    I assume that there must be a way to specify the default value for later, but I can't find it anywhere.  Any ideas?

    I know that you can drag the item out of the table container.  Change the default value on this scalar element.  Then drag the item in table tank.

  • How to set the default value for the digital control on front panel?

    How to set a default value for a numeric control of LabVIEW 2009 Front Panel? I have several input values that are actually configuration settings I want to settle with the default values of zero. I want them to be the values displayed when the façade first appears until the code is executed.

    I really want to use the Minimum and Maximum limits by default for this because I still want to be able to define acceptable limits for values.

    I would not be able to specify a default value of zero for these entries?

    Enter the desired value, then "right click...... of default data of value to operations. Save the VI.

  • How to set the initial value programmatically in af:selectOneChoice

    Hi all

    How to set the initial value programmatically in af:selectOneChoice

    filled with view object instance, but I want to show the value initial programmactically

    This can help you: Re: how to set the default value of the component selectOneChoice in ADF

    and the default af:selectOneChoice programmatically from backing bean

  • Specify a default value for a column in a Script

    Greetings fellow Forum inhabitants,

    Thank you in advance for taking the time to read and answer my post! (thumbs up)

    I'll jump in full.

    I've already created table:

    CREATE TABLE Bill

    (

    OrdID number 4 NOT NULL,

    Description VARCHAR2 (30) NOT NULL,

    ProdID NUMBER (6)

    actualprice NUMBER (8.2)

    NUMBER Qty. (8).

    itemtot NUMBER (8.2)

    );.

    I have to create a script to load the rows in the table of the invoice by the intervention of the user. However, I specify a default value for quantity

    That's what I have so far:

    INSERT INTO Bill (ordid, description, prodid, actualprice, qty, itemtot)

    VALUES (& & ordid, & & description, & & prodid, & & actualprice, by DEFAULT, & & itemtot)

    WHERE qty = DEFAULT;.

    or

    WHERE DEFAULT = 1;

    or

    ??

    I don't know where I am going wrong. I apologize if I'm unable to communicate what she I'm actually doing.

    Any advice would be appreciated.

    Thanks again for your time.

    Hello

    e752a7a0-bab5-4ee4-9ea4-bf7c4a2cadab wrote:

    Greetings fellow Forum inhabitants,

    Thank you in advance for taking the time to read and answer my post! (thumbs up)

    I'll jump in full.

    I've already created table:

    CREATE TABLE Bill

    (

    OrdID number 4 NOT NULL,

    Description VARCHAR2 (30) NOT NULL,

    ProdID NUMBER (6)

    actualprice NUMBER (8.2)

    NUMBER Qty. (8).

    itemtot NUMBER (8.2)

    );.

    I have to create a script to load the rows in the table of the invoice by the intervention of the user. However, I specify a default value for quantity

    That's what I have so far:

    INSERT INTO Bill (ordid, description, prodid, actualprice, qty, itemtot)

    VALUES (& ordid, & description, & prodid, & actualprice, by DEFAULT, & itemtot)

    WHERE qty = DEFAULT;.

    or

    WHERE DEFAULT = 1;

    or

    ??

    I don't know where I am going wrong. I apologize if I'm unable to communicate what she I'm actually doing.

    Any advice would be appreciated.

    Thanks again for your time.

    Sorry, I can't understand what you want.

    If you want the production order 1, then put a literal 1 for the value of this column:

    INSERT INTO Bill (ordid, description, prodid, actualprice, qty, itemtot)

    VALUES (& ordid, ' & description', & prodid, & actualprice, 1, & itemtot)

    ;

    or, if that value is used elsewhere in your script, set a variable substitution:

    DEFINE Qty = 1

    INSERT INTO Bill (ordid, description, prodid, actualprice, qty, itemtot)

    VALUES (& ordid, ' & description', & prodid, & actualprice, & qty, & itemtot)

    ;

    I hope that answers your question.

    If this isn't the case, post an example, such as:

    "If the user types... then the created line must contain... but if the user types... then the new line should be... »

    Simplify the question.  Do you really need 6 columns to show what you don't understand?  Why not just 2 or 3 columns?

    See the FAQ forum: https://forums.oracle.com/message/9362002

  • Web site created by Muse. The greats until tweek of today. Web site insists now for open index.html in the tablet. Don't know how product, nor how to change the default value for pc of office/index.html. Would advise. Bob

    Web site created by Muse. The greats until tweek of today. Web site insists now for open index.html in the tablet. Don't know how product, nor how to change the default value for pc of office/index.html. Would advise. Bob

    Hi Bob

    I think that you have found the solution but if still you are facing the question, please give me the url of the site that opens another provision in the tablet.

    Please make sure desktop redirection is checked in the site properties page layout.

    Thank you

    Sanjit

  • How to assign the next value in the sequence directly in a variable?

    How to assign the next value in the sequence directly in a variable without using a table TWICE in PL/SQL.

    BluShadow wrote:

    How about a quick test on 11g, just to see if you directly select a sequence in a variable is significantly better than the mark of DOUBLE.

    ...

    Nope... no obvious difference.

    This is because there is none: Oracle's SELECT sequence. NEXTVAL FROM DUAL under the covers. The direct assignment is just a convenient encoding for us, but it does not change the work that accomplishes Oracle.

    create sequence s;
    alter system flush shared_pool;
    declare
    l_num number;
    begin
    l_num := s.nextval;
    end;
    /
    select sql_text from v$sql where parsing_schema_name = user;
    
    SQL_TEXT
    Report the number of l_num; begin l_num: = s.nextval; end;
    Select sql_text from v$ sql where parsing_schema_name = user
    Select double S.NEXTVAL
  • How can I email a card for people who use my SkyDrive?

    How can I email a card for people who use my SkyDrive?

    How can I email a Christmas card to people who use my SkyDrive?

    It has nothing to do with Word, but you either put the Christmas card in the Public folder and send link to this folder for people who want to 'receipt' card, or create a new folder and invite these people to access this folder in which you put the Christmas card.

    Should ask questions about SkyDrive in http://windowslivehelp.com/

  • How to activate my MSF program for I could use more than 30 minutes at a time

    I had to uninstall my Microsoft Flight Simulator X and MSF - program of acceleration of my PC and reinstall them.  I did it.  When I installed FSX-Deluxe edition, the program asked me the activation number, I gave and then reinstalled the acceleration program. He asked for all the numbers, but now when I run the program, it suits me after 30 minutes then and asks for the active program.  I tried to use the Enternet and everything, but I can't well any place where I can activate this program.  I even call your hotline, they were of no help at all.  First I did not understand that you are Tech. He talked so fast and has no sense at all.  My question is: How can I activate the program? without going to halfway around the world to do. I never had this problem in the past, why now?

    Chuck Baumgartner

    Hello

    I suggest you to follow the steps mentioned in the article below and let us know if the problem is solved or not.

    How to activate my MSF program for I could use more than 30 minutes at a time

    http://support.Microsoft.com/kb/925723

    Also check the links below.

    Frequently asked questions on how to enable Microsoft Games for Windows, streets and trips and Mappoint

    http://support.Microsoft.com/kb/927007

    Microsoft Flight Simulator X Service Pack 2 Readme

    http://www.Microsoft.com/products/games/FSInsider/downloads/pages/SP2-en-Readme.aspx

  • How do subtract you different values for items in a specific table?

    Hi LabVIEW community.

    I am new to LabVIEW and Im working on my first application. One of my challenges I have problems is to know how to avoid specific values of some elements in a table.

    My application is to measure the distance between sensor and magnet, however the initial distance for each magnet sensor is different. I have converted the tension up to a distance using the Math node for each element and now need to correct these values by subtracting their initial value.

    The source is a table 1 d of DBL64 composed of 32 elements and each of these values must have a different value subtracted.

    for example:

    Element 1 - 5.557

    element 2 - 2.34

    3-7 654 element and so on

    I tried to separate them (index table) and subtract the values of each item and then combine them again. This was not effetive. I need to write these values in a .txt file and also to use them in another calculation.

    I have attached my attempted under VI.

    Any advice would really be apprecieated.

    You don't need to look it. There is a very simple method. Generate a table that contains all your desired offsets.  Then he subtract off the coast.

    This is the VI even with this change:

  • How to set an initial view for all documents

    I use Adobe Acrobat 9 Pro.  I would like to first full page for all my documents. I know that I can specify the initial view of a document (File - Preferences - view initial - magnification - Fit Page) but I want to Adobe Acrobat 9 Pro to open any document in Fit Page view initial no matter how it has been specified in the file.

    I can't find a setting that will allow me to do.  Is there a way to do this?

    You can not force it to all PDF documents. You set your app "-online-online Page view editing preferences" settings, to behave as you want to a file PDF who do not have an initial display assigns a different parameter of "Default". This is done because Adobe thinks that the author of the PDF knows better.

  • How to assign an initial value by using the driaver or traditional?

    Hi all

    the question is quite simple: I use PCI - 6014 with driver OR traditional DAQ (so far). I have a device connected to a set of things to do in order to provide for a grouping, which selects the operating mode. As soon as the device is triggered and I initialize the DIO, I attribute the initial values BD. The problem is that it takes a while (approx. 15 ms) to do, and during this time (between the initialization of the devices and the initial assignment) the combination of output is one level 0, which is highly undesirable because of the specificity of the device. Is it possible to "encode" the initial values of the things to do, so that, as soon as data is turned on, and the line is declared as DO, it automatically receives the pre-defined value?

    Thank you in advance,

    Mike

    Have you read the card? The answer is no.

  • How to set the initial value of the same value as the Page loading of SelectOneMenu

    Hello

    I noticed that in my value = "#{bean.selectedItem page}" of selectonemenu is always null when loading the page and because of that there is a difference in the initial value and the value sent as valuechangelistener is shot because of this difference, I don't want to happen. "

    I call the method to load the values into selectonemenu in the constructor of my bean.

    How can I make sure that the initial value is always the same as the value at the time of page load so that valuechangelistener would not fire unless the user changes the options in selectonemenu. Because of this problem I am facing a lot of issues like valuechangelistener is going to get fired.

    Any help is much appreciated.

    Thank you

    Yes, you will need to find a way to set the value before the creation of the part of the view. Generally, there are two ways. There are at least two ways, I tend to use:

    (1) loading deferred; you would get a Get accessor like this method:

    public String getValue(){
      if(value == null){
        // code here to get value from wherever
      }
    
      return value;
    }
    

    (2) initialize properties in a method annotated with @PostConstruct in your backing bean

    @PostConstruct
    public void initialize(){
      value = whatever;
    }
    

    Hope that helps you. If this isn't the case, so I totally misunderstood you and you try to explain more clearly what your problem is.

Maybe you are looking for