Creating an auto incrementing field with CREATE TABLE from Java
I'm using the "sun.jdbc.odbc.JdbcOdbcDriver" to get a connection towards an ODBC data source that's linked to a Access (.mdb) database.
I've tried various combinations in my CREATE TABLE statement execution in order to create a table with an auto incrementing integer but neither of them work, not even the most obvious one:
stmt.executeUpdate("CREATE TABLE mytable(uid integer AUTO_INCREMENT PRIMARY KEY);");
I always get this runtime exception: *java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error in field definition*; and AUTO_INCREMENT is the problem. I've tried all variations like AUTO, INCREMENT, AUTOINCREMENT and such, but nothing works.
I've looked everywhere but couldn't find an answer to this. Thanks for the help.
You used MySQL syntax. I think you agree with me that Access isn't a MySQL database. Either use MySQL with a real JDBC driver (recommended) or use Access syntax.
That said, creating databases and tables using Java is a bad idea. The database and table must be already there. With Java you just do the usual table operations like select, insert, update and delete. Nothing more is needed.
Similar Messages
-
Auto increment field with reset in a query
Hi,
I have the following query, I want 'field number' should count as a auto increment number and reset accordingly a group. e.g
for the group 1 if there are 10 rows then it should give me rownum as 1--10
for the group 2 if therea are 5 rows then it should give me rownum as 1--5
select d.drop_prog_id,
a.opre_cms_oppty_id,
c.more_tipo_revisione,
decode(f.grdo_prog_id,16,null,
decode(f.grdo_prog_id,75,'Other','Euro')
) Field_Number,
decode(f.grdo_prog_id,16,e.doma_testo, f.grdo_descrizione) GROUP1,
decode(f.grdo_prog_id,16,h.risp_valore,d.drop_valore_risposta) MILESTONE_RESPONSE,
d.drop_valore_commento1,
d.drop_valore_commento2
from wrt.tr002_opportunita_revisioni a,
wrt.tr005_opportunita_rev_moduli b,
wrt.tr008_moduli_revisione c,
wrt.tr006_domande_risposte_oppor d,
wrt.tr009_moduli_domande g,
wrt.tr010_domande e,
wrt.tr012_gruppo_domande f,
wrt.tr015_risposte h
where b.ormo_opre_prog_id = a.opre_prog_id and c.more_prog_id in (1, 19) and
d.drop_ormo_prog_id = b.ormo_prog_id
and d.drop_modo_prog_id = g.modo_prog_id
and g.modo_more_prog_id = c.more_prog_id and
g.modo_doma_prog_id = e.doma_prog_id
and e.doma_grdo_prog_id = f.grdo_prog_id
and (f.grdo_prog_id in (76, 75)
or (e.doma_testo like '%Are payment terms from invoice%' and
f.grdo_prog_id = 16))
and a.opre_ultima_revisione = 'S'
and h.risp_prog_id = d.drop_risp_prog_id
group by d.drop_prog_id,
a.opre_cms_oppty_id,
c.more_tipo_revisione,
drop_prog_id,
e.doma_testo,
d.drop_valore_risposta,
h.risp_valore,
d.drop_valore_commento1,
d.drop_valore_commento2,
f.grdo_descrizione,
f.grdo_prog_id
order by a.opre_cms_oppty_id,
min(f.GRDO_ORDINE) ,
min(g.MODO_ORDINE)row_number() over (partition by <group> order by <whatever>)
-
Creating auto-increment field in SharePoint List
In SharePoint, we can create the auto-incremental field by many ways, I am going to discuss two ways of doing it.
Calculated field
Item Event Receiver
1. Using Calculated field:
Using this we can accomplish it without doing any programing and it is a relatively simple way of doing it. By using “Calculated” column in SharePoint List we can create auto-increment field. We can accomplish this by creating a new column and choosing the
column type as “Calculated (calculation based on other columns)”. And in Formula field, we have to enter [ID]
In fact this will be using the values from “ID” field from SharePoint list that starts from 1.
For example, if we want to start our auto-increment column from 100, we can modify the “Formula” field of Create New column screen, we can have to enter [ID] + 99
For detailed info please follow the blog I wrote here: http://faisalrafique.wordpress.com/2011/03/19/creating-auto-increment-field-in-sharepoint-list/
2. Using Item Event Receiver:
By using this strategy, users have advantage to edit the existing values, we can also avoid it by making field read-only on feature activation. Using item event receiver, on ItemAdded event, we have to find the highest value among previously added items
and then save the incremented value to current newly created auto-incremental column.
For code of event reciever please follow the blog I wrote here:
http://faisalrafique.wordpress.com/2011/03/19/creating-auto-increment-field-in-sharepoint-list/
Happy CodingUse Sharepoint Designer to create a Workflow for the list containing the field to increment. For my project I had an Invoice field that I wanted to start with 1001 and increment from there so I made the following workflow to do this.
In the new workflow screen in Sharepoint Designer create two actions in Step 1:
Calculate Current Item:ID plus 1000 (Output to Variable: calc)
then Set AutoIncrementNumber to Variable: calc
This is just a guide. If you just want the auto-increment to start with 1 then you can just use this step
Set AutoIncrementNumber to Current Item:ID
Also, make sure you select the correct name for your field in the Workflow action instead of AutoIncrementNumber.
Save the Workflow, close it, and then open it again in Sharepoint Designer. Check the box for "Start workflow automatically when an item is created." Save it again and then click on the Publish button to make it active on the sharepoint site. The value should
now increment for each new item created in the list. -
Problem with Auo Increment field in Database table
HI...
I have a table with Auto increment field.
I am using Sql Server 2000.
I have a Table Component on front end which is binded with that (auto increment) table.
When I call commitChanges() I receive following exception :
Exception Details: java.lang.RuntimeException
Number of conflicts while synchronizing: 1 SyncResolver.INSERT_ROW_CONFLICT row 2 [sunm][SQLServer JDBC Driver][SQLServer]Cannot insert explicit value for identity column in table 'Authorization_Book' when IDENTITY_INSERT is set to OFF.Anybody knows the solution...The following excerpts are from http://blogs.sun.com/roller/page/jfbrown?entry=using_creator_to_insert_into. Do they help?
What about IDENTITY or AUTOINCREMENT or other database-generated columns?
This is highly database dependent. Some databases require you to obtain the key through vendor-specific means. Others say "set the value to null". Some say to not include the column in the INSERT statement.
So how do I exclude my IDENTITY or other column from the INSERT statement?
Use the RowSet's advanced insertableColumns property. Create a boolean[] array with one value for each column in the result. Use true to include the column in the INSERT statement, otherwise use false. The RowSet's property sheet doesn't allow you to set this property (in Creator2-EA2), so set the property in your java code. -
How to use auto incremented tabe to create a CMP Entity Bean
hi,
I want create a CMP entitybean with an auto incremented table in
Oracel. So I need to know
- how to create a table with an auto-incremented field in oracel and
- how to change the create() method according to that.
I am using Sun studio enterprise for EJB developing.
kaushalyaFor auto increment in Oracle you should use Sequence/Trigger combination.
And useful thread from EJB forum:
http://forum.java.sun.com/thread.jspa?forumID=13&threadID=478783 -
How to create Using Formatted Text Field with multiple Sliders?
Hi i found the Java Sun tutorial at http://java.sun.com/docs/books/tutorial/uiswing/components/slider.html very useful, and it tells how to create one Formatted Text Field with a Slider - however i need to create Formatted Text Field for multiple Sliders in one GUI, how do i do this?
my code now is as follows, and the way it is now is scroll first slider is okay but scrolling second slider also changes value of text field of first slider! homework due tomorrow, please kindly help!
// constructor
label1 = new JLabel( "Individuals" );
scroller1 = new JSlider( SwingConstants.HORIZONTAL, 0, 100, 10 );
scroller1.setMajorTickSpacing( 10 );
scroller1.setMinorTickSpacing( 1 );
scroller1.setPaintTicks( true );
scroller1.setPaintLabels( true );
scroller1.addChangeListener(this);
java.text.NumberFormat numberFormat = java.text.NumberFormat.getIntegerInstance();
NumberFormatter formatter = new NumberFormatter(numberFormat);
formatter.setMinimum(new Integer(0));
formatter.setMaximum(new Integer(100));
textField1 = new JFormattedTextField(formatter);
textField1.setValue(new Integer(10)); //FPS_INIT
textField1.setColumns(1); //get some space
textField1.addPropertyChangeListener(this);
//React when the user presses Enter.
textField1.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "check");
textField1.getActionMap().put("check", new AbstractAction() {
public void actionPerformed(ActionEvent e) {
if (!textField1.isEditValid()) { //The text is invalid.
Toolkit.getDefaultToolkit().beep();
textField1.selectAll();
} else try { //The text is valid,
textField1.commitEdit(); //so use it.
} catch (java.text.ParseException exc) { }
label2 = new JLabel( "Precision" );
scroller2 = new JSlider( SwingConstants.HORIZONTAL, 0, 100, 8 );
scroller2.setMajorTickSpacing( 10 );
scroller2.setMinorTickSpacing( 1 );
scroller2.setPaintTicks( true );
scroller2.setPaintLabels( true );
scroller2.addChangeListener(this);
textField2 = new JFormattedTextField(formatter);
textField2.setValue(new Integer(10)); //FPS_INIT
textField2.setColumns(1); //get some space
textField2.addPropertyChangeListener(this);
//React when the user presses Enter.
textField2.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "check");
textField2.getActionMap().put("check", new AbstractAction() {
public void actionPerformed(ActionEvent e) {
if (!textField2.isEditValid()) { //The text is invalid.
Toolkit.getDefaultToolkit().beep();
textField2.selectAll();
} else try { //The text is valid,
textField2.commitEdit(); //so use it.
} catch (java.text.ParseException exc) { }
// State Changed
public void stateChanged(ChangeEvent e) {
JSlider source = (JSlider)e.getSource();
int fps = (int)source.getValue();
if (!source.getValueIsAdjusting()) { //done adjusting
if(source==scroller1) {
System.out.println("source ==scoller1\n");
textField1.setValue(new Integer(fps)); //update ftf value
else if(source==scroller2) {
System.out.println("source ==scoller2\n");
textField2.setValue(new Integer(fps)); //update ftf value
} else { //value is adjusting; just set the text
if(source==scroller1) textField1.setText(String.valueOf(fps));
else if(source==scroller2) textField2.setText(String.valueOf(fps));
// Property Change
public void propertyChange(PropertyChangeEvent e) {
if ("value".equals(e.getPropertyName())) {
Number value = (Number)e.getNewValue();
if (scroller1 != null && value != null) {
scroller1.setValue(value.intValue());
else if (scroller2 != null && value != null) {
scroller2.setValue(value.intValue());
// ACTION PERFORMED
public void actionPerformed(ActionEvent event) {
if (!textField1.isEditValid()) { //The text is invalid.
Toolkit.getDefaultToolkit().beep();
textField1.selectAll();
} else try { //The text is valid,
textField1.commitEdit(); //so use it.
} catch (java.text.ParseException exc) { }
if (!textField2.isEditValid()) { //The text is invalid.
Toolkit.getDefaultToolkit().beep();
textField2.selectAll();
} else try { //The text is valid,
textField2.commitEdit(); //so use it.
} catch (java.text.ParseException exc) { }
...if :p3_note_id is null
then
insert into notes (project_id, note, notes_month, notes_year) So, p3_note_id is NULL.
Another option is that you have a trigger on table NOTES that generates a new note_id even for an update. -
Create search helps for fields of custom tables
Hi,
Could any one please provide me the step by step process to create search helps for fields in custom tables?
Thanks in advance,
Nobin.Hello Nobin
There is basically no difference between a search help for standard vs. customer tables.
An important choise is the selection method for your search help:
Either you use your custom table, a view or a search help user-exit if you need to implement very specific requirements.
Assuming that you can use your DB table as selection method the further implementation of the search help is quite straightforward:
(1) Define the parameters you would like to have a selection criteria (SPos = SPos) and which should appear on the result list (= LPos).
(2) Define the parameters that can be used as input for the selection (flag IMP) and are returned by the search help (flag EXP)
Regards
Uwe -
Auto increment field in database issue
Ok, I have read all about the issues with the auto increment field when trying to hook my form up to a ms access database.
My problem is that the auto increment field is the one field I want in my form.
Any suggestions how to create a new record with my form? its a simple database, date field, and PO number (the auto incremented field)
Just trying to get a fresh PO number on my PO form each time its filled out....I have a vital form that clients fill out, which is passed to many people in the company along the workflow. The form is a Planner and we have in the following PDF, Word Doc..
Well before, the Planner.pdf was originally created in Word, since most people have access to Word.. but evolved to a PDF form created from the Word Doc via Adobe LiveCycle Designer 8.0 w/ User Rights enabled so that the form could be filled out and saved using Adobe Reader.. which was a step better than Word.. being that it is free. But this needed to be easier and more to the point b/c some clients don't particularly like installing the latest version of Reader, even if you provide them the link. Nor do they like saving the form, filling the form, and attaching the form to send back.
My goal is to have the client fill an HTML version of the form, submit and be done with it, but everyone in the workflow be able to easily receive the filled Planner as a PDF form.
So some months ago I ran into this post Chris Trip, "Populate Livecycle PDF from mySQL database using PHP" #8, 22 Sep 2007 4:37 pm
which uses the command line Win32 pdftk.exe to merge an FDF file into an existing PDF on the remote server, and serve this to whoever.
My problem was with shared hosting and having the ability to use the Win32 pdftk.exe along with PHP which is predominantly used on Linux boxes. And we used a Linux box.
so i created the following unorthodox method, which a client fills the HTML version of the Planner, all field values are INSERTED into a table in MySQL DB, I and all filled planners that have been filled by clients to date can be viewed from a repository page where an XML file is served up of the corresponding client, but someone would have to have Acrobat Professional, to import the form data from the XML file into a blank form.. altoughh this is simple for me.. I have the PHP file already created so that when a Planner is filled and client submits. >> the an email is sent to me with a table row from the repository of the client name, #, email, and a link to d-load the XML file,
But I also have the PHP files created so that the Planner can be sent to by email to various people in the workflow with certain fileds ommitted they they do not need to see, but instead of the XML file beiong served up i need the filled PDF Planner to be served.
I can do this locally with ease on a testing server, but I am currently trying to use another host that uses cross-platform compatibility so i can use PHP and the pdftk.exe to achieve this, as that is why I am having to serve up an XML file b/c we use a Linux server for our website, and cant execute the exe.
Now that I am testing the other server (cross-platform host), just to use them to do the PDF handling (and it's only $5 per month) I am having problems with getting READ, WRITE, EXECUTE permissions..
Si guess a good question to ask is can PHP do the same procedure as the pdftk.exe, and i can eleminate it.
or how in the heck can i get this data from the DB into a blank PDF form, like i have described??
here are some link to reference
Populating a LiveCycle PDF with PHP and MySQL
http://www.andrewheiss.com/Tutorials?page=LiveCycle_PDFs_and_MySQL
HTML form that passed data into a PDF
http://www.mactech.com/articles/mactech/Vol.20/20.11/FillOnlinePDFFormsUsingHTML/index.htm l
and an example
http://accesspdf.com/html_pdf_form/ -
Auto incremented field mobile device
hello,
my colleague requires to make a mechanism in the mobile device (oracle lite client) where the primary field of a table is automatically incremented.
according to the documentation in order to make that happen in a consistent manner so that all clients can sync correctly without ambiguities , we created a sequence
through the MDW and attached it to the publication. then with the sync , this sequence has been downloaded to all clients and each one has a specified window.
now we suppose that we must create the trigger that uses this sequence in order to provide the correct primary key field.
lets say that the sequence is names SYSTEM.AUTOINCSEQUENCEA
the table is named SYSTEM.TABLEA
and the primary key that we want to auto incr is named ID.
the trigger we suppose that should look like:
CREATE TRIGGER SYSTEM.TRIGGERTABLEA
BEFORE INSERT
ON SYSTEM.TABLEA REFERENCING NEW AS New OLD AS Old
FOR EACH ROW
BEGIN
select AUTOINCSEQUENCEA.nextval into :new.ID from dual;
END ;
1)But if i execute this from the msql on the client device (mobile windows device) it returns a "syntax error". how can i create the trigger that i need which will use my sequence in order
to appoint the new values on the primary key (auto incremented field??) .
2)if i cant do it through a normal sql statement then how can i do it?
thank youYou need Java Store Procedure as the trigger. PL/SQL is not support on the Oracle Lite client.
Let me know if you need an example on how to do this. -
I am using 3.0.3 and have a PC class that uses application identity and
MSSQL server, so we are using auto-increment fields for our primary keys.
In the past (with sequence-generated ids) we have used Integers for our
mapped attributes, but with the application identity, it seems we need to
use ints. Is there a reason for this, or is it a bug?
NathanGreat. Thanks for the help.
Nathan
"Marc Prud'hommeaux" <[email protected]> wrote in message
news:[email protected]...
Nathan-
This is a bug. I've reported it at:
http://bugzilla.solarmetric.com/show_bug.cgi?id=910
I expect it will be fixed in the next release. In the meantime, if you
want to use a numeric wrapper for your auto-increment field, it will
need to be of type java.lang.Long.
In article <[email protected]>, Nathan Voxland wrote:
It does work with Longs. I could switch my code to use Longs, although
I
don't always need that large of an id field.
Nathan
"Marc Prud'hommeaux" <[email protected]> wrote in message
news:[email protected]...
Nathan-
If you change them both from Integer to a Long field, then does it
work?
>>>
>>>
In article <[email protected]>, Nathan Voxland wrote:
Here is the code for the class and the ApplicationId class. The
ApplicationId class was generated using the appidtool.
public class Portfolio {
private Integer id;
private String name;
private String notes;
private Organization client;
private Portfolio parentPortfolio;
private Set subPortfolios;
private Set projects;
private Date created;
private Person createdBy;
private Date lastModified;
private Person lastModifiedBy;
public Portfolio(PersistenceManager pm) {
pm.makePersistent(this);
this.subPortfolios = new HashSet();
this.projects = new HashSet();
this.created = new Date();
this.createdBy = new PersonPeer(pm).findLoggedIn();
this.lastModified = this.created;
this.lastModifiedBy = this.createdBy;
public Integer getId() {
return new id;
public String getName() {
return name;
public void setName(String name) {
this.name = name;
public void jdoPostLoad() {
public void jdoPreStore() {
if (!((PersistenceCapable) this).jdoIsNew()) {
this.lastModified = new Date();
this.lastModifiedBy = new
PersonPeer(((PersistenceCapable)
this).jdoGetPersistenceManager()).findLoggedIn();
public void jdoPreClear() {
public void jdoPreDelete() {
* Auto-generated by:
* kodo.enhance.ApplicationIdTool
public class PortfolioId
implements Serializable
static
// register persistent class in JVM
Class c = Portfolio.class;
public Integer id;
public PortfolioId ()
public PortfolioId (String fromString)
if ("null".equals (fromString))
id = null;
else
id = new Integer (fromString);
public String toString ()
return String.valueOf (id);
public int hashCode ()
return ((id == null) ? 0 : id.hashCode ());
public boolean equals (Object obj)
if (this == obj)
return true;
if (!(obj instanceof PortfolioId))
return false;
PortfolioId other = (PortfolioId) obj;
return ((id == null && other.id == null)
|| (id != null && id.equals (other.id)));
Nathan
"Marc Prud'hommeaux" <[email protected]> wrote in message
news:[email protected]...
Nathan-
Is the primary key field an Integer in both the application
identity
class and the persistent class itself? They need to both be the same
class.
If they are the same, and you are still getting the exception, could
you post the code for the classes (or else mail them to
[email protected])?
In article <[email protected]>, Nathan Voxland
wrote:
When I have my object use an int id, my test runs fine, when Iswitch
to
an
Integer, I get the exception:
kodo.util.FatalException: java.lang.ClassCastException
NestedThrowables:
java.lang.ClassCastException
at
kodo.runtime.PersistenceManagerImpl.flush(PersistenceManagerImpl.java:563)
at
com.correlat.intranet.projectmanagement.PortfolioTest.testFlush(PortfolioTes
t.java:393)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
at com.intellij.rt.execution.junit2.IdeaJUnitAgent.doRun(UnknownSource)
at
com.intellij.rt.execution.junit.TextTestRunner2.startRunnerWithArgs(Unknown
Source)
at
com.intellij.rt.execution.junit2.JUnitStarter.prepareStreamsAndStart(Unknown
Source)
at com.intellij.rt.execution.junit2.JUnitStarter.main(UnknownSource)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
at com.intellij.rt.execution.application.AppMain.main(UnknownSource)
Caused by: java.lang.ClassCastException
at
com.correlat.intranet.projectmanagement.Portfolio.jdoReplaceField(Portfolio.
java)
atkodo.runtime.StateManagerImpl.replaceField(StateManagerImpl.java:2771)
at
kodo.runtime.StateManagerImpl.storeObjectField(StateManagerImpl.java:2272)
atkodo.runtime.StateManagerImpl.storeObject(StateManagerImpl.java:2252)
at
kodo.jdbc.meta.ValueFieldMapping.setAutoIncrementValue(ValueFieldMapping.jav
a:346)
atkodo.jdbc.meta.ClassMapping.setAutoIncrementValue(ClassMapping.java:381)
at
kodo.jdbc.runtime.PreparedStatementManager.flush(PreparedStatementManager.ja
va:137)
atkodo.jdbc.runtime.UpdateManagerImpl.flush(UpdateManagerImpl.java:357)
atkodo.jdbc.runtime.UpdateManagerImpl.flush(UpdateManagerImpl.java:153)
at
kodo.jdbc.runtime.UpdateManagerImpl.flush(UpdateManagerImpl.java:72)
atkodo.jdbc.runtime.JDBCStoreManager.flush(JDBCStoreManager.java:507)
at
kodo.runtime.DelegatingStoreManager.flush(DelegatingStoreManager.java:158)
at
kodo.datacache.DataCacheStoreManager.flush(DataCacheStoreManager.java:412)
at
kodo.runtime.PersistenceManagerImpl.flushInternal(PersistenceManagerImpl.jav
a:794)
at
kodo.runtime.PersistenceManagerImpl.flush(PersistenceManagerImpl.java:550)
... 24 more
NestedThrowablesStackTrace:
java.lang.ClassCastException
at
com.correlat.intranet.projectmanagement.Portfolio.jdoReplaceField(Portfolio.
java)
atkodo.runtime.StateManagerImpl.replaceField(StateManagerImpl.java:2771)
at
kodo.runtime.StateManagerImpl.storeObjectField(StateManagerImpl.java:2272)
atkodo.runtime.StateManagerImpl.storeObject(StateManagerImpl.java:2252)
at
kodo.jdbc.meta.ValueFieldMapping.setAutoIncrementValue(ValueFieldMapping.jav
a:346)
atkodo.jdbc.meta.ClassMapping.setAutoIncrementValue(ClassMapping.java:381)
at
kodo.jdbc.runtime.PreparedStatementManager.flush(PreparedStatementManager.ja
va:137)
atkodo.jdbc.runtime.UpdateManagerImpl.flush(UpdateManagerImpl.java:357)
atkodo.jdbc.runtime.UpdateManagerImpl.flush(UpdateManagerImpl.java:153)
at
kodo.jdbc.runtime.UpdateManagerImpl.flush(UpdateManagerImpl.java:72)
atkodo.jdbc.runtime.JDBCStoreManager.flush(JDBCStoreManager.java:507)
at
kodo.runtime.DelegatingStoreManager.flush(DelegatingStoreManager.java:158)
at
kodo.datacache.DataCacheStoreManager.flush(DataCacheStoreManager.java:412)
at
kodo.runtime.PersistenceManagerImpl.flushInternal(PersistenceManagerImpl.jav
a:794)
at
kodo.runtime.PersistenceManagerImpl.flush(PersistenceManagerImpl.java:550)
at
com.correlat.intranet.projectmanagement.PortfolioTest.testFlush(PortfolioTes
t.java:393)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
at com.intellij.rt.execution.junit2.JUnitStarter.main(UnknownSource)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
at com.intellij.rt.execution.application.AppMain.main(UnknownSource)
Nathan
"Patrick Linskey" <[email protected]> wrote in message
news:[email protected]...
What behavior are you seeing that is preventing you from using
Integers?
-Patrick
Nathan Voxland wrote:
I am using 3.0.3 and have a PC class that uses application
identity
and
MSSQL server, so we are using auto-increment fields for our
primary
keys.
In the past (with sequence-generated ids) we have used Integers
for
our
mapped attributes, but with the application identity, it seems
we
need
to
use ints. Is there a reason for this, or is it a bug?
Nathan
Marc Prud'hommeaux [email protected]
SolarMetric Inc. http://www.solarmetric.com
Marc Prud'hommeaux [email protected]
SolarMetric Inc. http://www.solarmetric.com
Marc Prud'hommeaux [email protected]
SolarMetric Inc. http://www.solarmetric.com -
Does all RDBMS support auto-increment field?
Hi,
I am designing a java application in which I have to write some logic to auto-increment one database field. Can anyone tell me that all the databases support the auto-increment fields.
Thanks in advance.
ChrisThere seem to be two kinds of facility for this in databases. One kind has an auto-increment field. Unfortunately they aren't consistent about how you obtain the value just created after an insert (which you almost invariably require to know). Generally you use a select statement to pick up the value of some kind of last row index function, but the name and syntax varies.
The other kind uses a separate object in the database called a SEQUENCE. You create this with a CREATE SEQUENCE statment, and generally you reference nextval(sequence_name) in the default attribute of the database field.
To get the last allocated sequence number you use select currval(sequence_name)
Again the syntax is a bit inconsistent. You should also probably use transaction isolation if someone else might be incrementing the same sequence. -
Auto Increment Field / Sequence - How?
Am I missing something here - is there no build in support to tie a datatables auto incriment field to a sequence so that it will be automatically retrieved on a update command?
I have a table that has a field (RECORD_ID) that gets it's value from a Sequence (RECORD_IDSEQ).
I am retrieving a dataset and setting the RECORD_ID field to autoincrement, setting the seed & step to -1. Then I am adding some records & I see the autoincrement field i working correctly. UNFORTUNATELY, I still have to iterate through the table before I call an update in order to insert (from another function) the RECORD_IDSEQ.NEXTVAL value into the RECORD_ID column.
Surely I am missing something. It sure seems simple enough to have a property of the autoincrement field/command builder that relates to the SEQUENCE name so that the update method generates the RECORD_IDSEQ.NEXTVAL automagically.
Can anyone shed any light on this for me?
Thanks!Bob,
Currently, there's no built-in "link" between the .NET DataTable's auto-increment field and the Oracle sequence.
Therefore, you will need to execute a custom update command or a custom insert command which uses the RECORD_IDSEQ.NEXTVAL for the RECORD_ID column (rather than the auto-generated SQL via the CommandBuilder).
Furthermore, in your custom SQL you can have a RETURNING clause which returns the RECORD_ID column value to populate back into the DataTable so that the sequence values in the Database is in sync with those in the DataTable.
We'll consider providing a way to "link" the DataTable auto-increment column to an Oracle sequence in a future release. -
How to Create adf table from java bean
Hi,
How to Create adf table from java class (Not from ADF BC).
Thanks
Satya@vlsn -- you have to follow what shay said.
Do the following in Model layer ::
create a table property java class with your columns setters and getters like :
*public class gridProps {*
private int sno;
private String orderNum;
*public void setSno(int sno) {*
this.sno = sno;
*public int getSno() {*
return sno;
*public void setOrderNum(String orderNum) {*
this.orderNum = orderNum;
*public String getOrderNum() {*
return orderNum;
Create another table java class which will populate the values to your column values and return the collection :
*public class gridPopulate {*
private List<gridProps> gridValues ;
*public List<gridProps> setToGrid(ArrayList<ArrayList> valuesToSet) {*
*if (valuesToSet == null) {*
return gridValues;
gridValues = new ArrayList<gridProps>();
if(btnValue.equals("completeBtn"))
return gridValues;
for(ArrayList<String> tempArr:valuesToSet)
gridProps gp = new gridProps();
gp.setSno(Integer.valueOf(tempArr.get(0)));
gp.setOrderNum(tempArr.get(1));
return gridValues;
Right click gridPopulate class and create this as data control.This class will be seen in Data control list.Under this data control,Drag the grid property collection(created earlier) to your page.Then execute your binding(gridPopulate) according to your logic.
Thanks.(My jdev version 11.1.1.5.0) -
How to View Tables from java side from NWDS/NWDI?
HI All,
I want to view the following tables from java side
CRM_ISA_ADDRESS
CRM_ISA_BASKETS
CRM_ISA_BUSPARTNER
CRM_ISA_EXTCONFIG
CRM_ISA_EXTDATHEAD
CRM_ISA_EXTDATITEM
CRM_ISA_ITEMS
CRM_ISA_OBJECTID
CRM_ISA_SHIPTOS
CRM_ISA_TEXTS
How can I view them using NWDS/NWDI?
Which DC has this tables?
Could you please help me with the procedure to view them?
Thanks and Regards,
GauriHi All,
crm/isa/isacoreddic and crm/isa/shopddic in SAP-CRMDIC are having these tables.
Thanks and Regards,
Gauri -
How to trigger tree table from java code
Trying to trigger tree table from java code, using :
AdfFacesContext.getCurrentInstance().addPartialTarget(treeTableComponent);
But its not working. Am i using the correct approach?Sorry for the incomplete information,
I have a tree table in a region and that region i am including inside a jspx file. In the region i have one popup and based on the input taken from the popup i want to trigger the table to show the data.
For that i am trying :
FacesContext context = FacesContext.getCurrentInstance();
UIComponent component = findComponent( context.getViewRoot(),"treeTableID");
if(component != null){
AdfFacesContext.getCurrentInstance().addPartialTarget(component);
public static UIComponent findComponent(UIComponent base, String id)
if (id.equals(base.getId()))
return base;
UIComponent children = null;
UIComponent result = null;
Iterator childrens = base.getFacetsAndChildren();
while (childrens.hasNext() && (result == null))
children = (UIComponent) childrens.next();
if (id.equals(children.getId()))
result = children;
break;
result = findComponent(children, id);
if (result != null)
break;
return result;
Model is getting data before i use : AdfFacesContext.getCurrentInstance().addPartialTarget(component);
But table is not calling getData() in model to show the populated data on UI.
Maybe you are looking for
-
So I need to publish my iWeb site to a Windows server on a secure I can't access directly. I believe I need to export my iWeb site to a local folder on my Mac, then transfer those files to the computer that has access to the server. I tried this ear
-
I have read the other threads on this topic and wondered if anyone had a definitive answer from apple....My 15" Pb has just developed the fault but i'm not sure what has caused it and if it is software or hardware related....On my Pb it seems to just
-
Creative mediasource organizer not recognizing zen microph
I jusr recently had to restore my laptop to factory settings so I had reinstall creative. But now when I open the mediasource to try to get songs off of my microphoto on onto my laptop, it doesn't show my zen in the little dropdown where it shoes pc
-
2LIS_02_SCL extractor is delivering wrong document currency amount
Dear all, We are currently trying to get the invoiced amount of a purchase order in the document currency (of the invoice). While extracting the Purchasing Orders via the 2LIS_02_SCL we discover that the invoiced amount in document currency (BWGEOO)
-
Problem with the music gallery after 2.3 update
Hello Just recently updated my XperiaX10i (French version, not operator sim locked). No problem with the update itself and the phone seems to work properly. But, the music gallery did first not detect the music files already in the 32Go sd card (no p