Error & Missing explanation in docs regarding Auto Increment / Identity
Hi Data Modeler-Team, Hi fellow readers,
could you please explain the meaning of option
"Column Properties" - "General" - "Identity" (next to "Auto Increment"), as I don't see a logical difference between those two.
Also, the meaning of these fields is left out in the docs under
http://docs.oracle.com/cd/E18464_01/doc.30/e15802.pdf "3.8 Column Properties" - "General" (page 75)
Thanks,
Blama
(WinXP, Version 3.0.0.665)
Edited by: bl**** on 30.12.2011 15:40
Hi Philip, Hi David,
thank you for your answers.
I saw now that "identity" is removed for one column if I assign "identity" to another column and that I can have many auto-increments within one table.
But what does "identity" mean exactly? I don't see a difference in the displayed relational model and also don't see a difference in the created DDL.
Isn't "identity" from the meaning the same as a Primary Key?
Thanks,
Blama
Similar Messages
-
Utilizing auto-increment/identity fields for primary key with "application" identity
Is it possible to utilise an auto-increment (identity in MS SQL Server)
field for the primary key field when using "application" identity?To the best of my knowledge, you cannot use auto-increment. Due to the
differences in the way that identities are generated at the datastore
(upon insert) vs. JDO (upon makePersistent), this feature of SQLServer is
not supported yet.
However, we do provide a variety of other ways of generating identity
which may provide a closer fit to what you want, and
our users may have some experience in solving your problem.
On Tue, 28 Jan 2003 09:56:08 +0000, Sean Ryan wrote:
Is it possible to utilise an auto-increment (identity in MS SQL Server)
field for the primary key field when using "application" identity?--
Stephen Kim
[email protected]
SolarMetric, Inc.
http://www.solarmetric.com -
how can i auto increment the number in my table while inserting the data
Good point. If any error occurs during insertion -
the sequence will be broken. Bucause, even if your
transaction failed sequence will generate the new
sequence number. But, as a result of that error -
insertion won't be taken into place. Thus, break your
continous chain.It is probably good point (depending on requirements) irregardless of that.
Sequences ARE NOT for CONTINUOUS number generation.
Sequences ARE for UNIQUE number generation.
Continous chain will break also at least rollback (always) and DB restart as well (unless you haven't specified sequence as nocache which generally is silly idea).
Gints Plivna
http://www.gplivna.eu -
Auto-increment identity column through procedure in oracle 10g on windows
Hi,
I need identity primary key which should be auto increment before while inserting data into table.
for this i had use sequence and then trigger to increment it.
but now i need to increment it in Procedure, while my procedure is having code to insert data in same table which has primary keyHi,
SNEHA RK wrote:
Hi,
I need identity primary key which should be auto increment before while inserting data into table.
for this i had use sequence and then trigger to increment it.Right. Some database products have auto-increment columns, and they are really handy. Unfortunately, Oracle does not have auto-increment columns. A sequence is an auto-increment object, and it's the right way to automatically generate unique identifiers, but you need to explicity reference the sequence, either in you DML statements, or in a trigger that will automatically fire before a DML statement.
but now i need to increment it in Procedure, while my procedure is having code to insert data in same table which has primary keyAre you saying that you need to increment the sequence, completely aside from INSERTing into the table?
If so, just reference sequence_name.NEXTVAL wherever you want to. In PL/SQL, you can say
SELECT sequence_name.NEXTVAL
INTO number_variable
FROM dual;This works in any version of Oracle, but starting in Oracle 11, you also have the option of referencing te sequence without using dual, or any other table.
I hope this answers your question.
If not, post a complete script that people can run to re-create the problem and test their ideas.
For example:
-- Here are the table and the seqauence that I created:
CREATE TABLE table_x ...
CREATE SEQUENCE ...
-- Here is the BEFORE INSERT trigger I wrote:
CREATE OR REPLACE TRIGGER ...
-- The trigger works exactly how I want it to in statements like this:
INSERT INTO table_x ...
-- So there are no problems (that I know of) with anything up to this point.
-- Now I want to use the same sequence to ...
-- so that when I execute a statement like this
-- then the next time I add a new row to the orginal table, like this
INSERT INTO table_x ...
-- then the contents of table_x should be ... because ... -
Auto Increment Not Working - SQL Identity field
I am new to Visual Basic & SQL server but have some experience in Access & VBA. But this is a steep learning curve!
I am banging my head against a wall with a problem..
All of my tables in this database are in the dataset. The main one being tblItems with a PK 'ITEMID'
I have 2 forms - the first one is used to lookup an item the second displays the item's full details.
On the first form (lookup) I have a 'Add New' button which launches the second form with the code - frmProductDetail.VItemsBindingSource.AddNew()
This opens the form with empty boxes as expected. I have a 'Save' button on the second form with the following code -
Dim row As SASHItemsDataSet.tblItemsRow
row = SASHItemsDataSet.tblItems.NewRow
With row
.ITEMCODE = txtItemCode.Text
.ITEMDESCRIPTION = txtItemDescription.Text
.CATEGORY = cmbItemCategory.SelectedValue
.PURCHCOST = txtPurchCost.Text
.SELLCOST = txtSellPrice.Text
.UNIT = cmbUOM.SelectedValue
.VATID = cmbVAT.SelectedValue
.WHLOCATION = cmbWHLoc.SelectedValue
End With
SASHItemsDataSet.tblItems.Rows.Add()
Try
Me.Validate()
Me.VItemsBindingSource.EndEdit()
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Critical + MsgBoxStyle.OkOnly, "UPDATE FAILED")
End Try
My problem is I get the error msg box with the following error 'Column 'ITEMID' does not allow nulls'
This field is set as a auto incrementing identity field with all the correct settings shown in Visual Studio so it shouldn't be coming back as null.
I have Googled for hours & tried all sorts with no luck..
I have clearly gone wrong somewhere but I can't work out where... any help appreciated!
JamesThis is the code on frmProductLookup that opens the form...
frmProductDetail.Show()
frmProductDetail.VItemsBindingSource.AddNew()
This is the code on frmProductDetail_Load...
'TODO: This line of code loads data into the 'SASHItemsDataSet.tblVAT' table. You can move, or remove it, as needed.
Me.TblVATTableAdapter.Fill(Me.SASHItemsDataSet.tblVAT)
'TODO: This line of code loads data into the 'SASHItemsDataSet.tblWarehouseLocations' table. You can move, or remove it, as needed.
Me.TblWarehouseLocationsTableAdapter.Fill(Me.SASHItemsDataSet.tblWarehouseLocations)
'TODO: This line of code loads data into the 'SASHItemsDataSet.tblStockUnits' table. You can move, or remove it, as needed.
Me.TblStockUnitsTableAdapter.Fill(Me.SASHItemsDataSet.tblStockUnits)
'TODO: This line of code loads data into the 'SASHItemsDataSet.tblItemCategory' table. You can move, or remove it, as needed.
Me.TblItemCategoryTableAdapter.Fill(Me.SASHItemsDataSet.tblItemCategory)
'TODO: This line of code loads data into the 'SASHItemsDataSet.vItems' table. You can move, or remove it, as needed.
'Me.VItemsTableAdapter.Fill(Me.SASHItemsDataSet.vItems)
Me.VItemsTableAdapter.Fill(Me.SASHItemsDataSet.vItems)
Me.VItemsBindingSource.Position = Me.VItemsBindingSource.Find("ITEMID", _passedText)
Me.txtWKSName.Text = Environment.MachineName
Me.txtSellPrice.Text = FormatCurrency(Me.txtSellPrice.Text)
Me.txtPurchCost.Text = FormatCurrency(Me.txtPurchCost.Text)
Me.txtPriceIVAT.Text = FormatCurrency(Me.txtSellPrice.Text + (Me.txtSellPrice.Text * 0.2))
On the tblItemTableAdapter this is the Command Text for the Insert Command...
INSERT INTO tblItems
(ITEMCODE, ITEMDESCRIPTION, UNIT, WHLOCATION, VATID, PREFSUPPLIER, CATEGORY, PURCHCOST, SELLCOST, INACTIVE)
VALUES (@ITEMCODE,@ITEMDESCRIPTION,@UNIT,@WHLOCATION,@VATID,@PREFSUPPLIER,@CATEGORY,@PURCHCOST,@SELLCOST,@INACTIVE)
SQL Server Management Studio clearly shows the column as an Identity column. If I add a row through SSMS it does create an PK identity automatically. I have also dropped the ITEMID column & recreated through SSMS which has no effect.
I am now considering creating a separate form just for adding an item but I have managed it in Access but am just struggling with VB!
Thanks,
James -
Trying to create cmp correctly(auto-increment);error while running
I am using the latest versions of Jboss(4.0.5.GA) and Lomboz(R-3.2-200610201336) along with SQL Server 2005 and Microsoft's SQL Server 2005 JDBC driver.
Lomboz used xdoclet to create the java files based on the SQL table but it did not put anything in the DoctorBean.java file telling it that the primary key was auto-incremented.
Using the JSP files, I can retreive data out of the database fine so I know the connection and drivers are set up properly.
Here is the error:
09:16:46,815 WARN [ServiceController] Problem starting service jboss.j2ee:service=EjbModule,module=MedicalEJB.jar
java.lang.StringIndexOutOfBoundsException: String index out of range: 0
at java.lang.String.charAt(Unknown Source)
at org.jboss.mx.loading.RepositoryClassLoader.loadClassLocally(RepositoryClassLoader.java:197)
at org.jboss.mx.loading.UnifiedLoaderRepository3.loadClassFromClassLoader(UnifiedLoaderRepository3.java:277)
at org.jboss.mx.loading.LoadMgr3.beginLoadTask(LoadMgr3.java:284)
at org.jboss.mx.loading.RepositoryClassLoader.loadClassImpl(RepositoryClassLoader.java:511)
at org.jboss.mx.loading.RepositoryClassLoader.loadClass(RepositoryClassLoader.java:405)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.jboss.util.loading.DelegatingClassLoader.loadClass(DelegatingClassLoader.java:89)
at org.jboss.mx.loading.LoaderRepositoryClassLoader.loadClass(LoaderRepositoryClassLoader.java:90)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.jboss.util.loading.DelegatingClassLoader.loadClass(DelegatingClassLoader.java:89)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCEntityCommandMetaData.<init>(JDBCEntityCommandMetaData.java:73)
at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCEntityMetaData.<init>(JDBCEntityMetaData.java:952)
at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCApplicationMetaData.<init>(JDBCApplicationMetaData.java:378)
at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCXmlFileLoader.load(JDBCXmlFileLoader.java:89)
at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.loadJDBCEntityMetaData(JDBCStoreManager.java:736)
at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.initStoreManager(JDBCStoreManager.java:424)
at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.start(JDBCStoreManager.java:368)
at org.jboss.ejb.plugins.CMPPersistenceManager.start(CMPPersistenceManager.java:172)
at org.jboss.ejb.EjbModule.startService(EjbModule.java:414)
at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
at $Proxy0.start(Unknown Source)
at org.jboss.system.ServiceController.start(ServiceController.java:417)
at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
at $Proxy25.start(Unknown Source)
at org.jboss.ejb.EJBDeployer.start(EJBDeployer.java:662)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
at org.jboss.mx.interceptor.DynamicInterceptor.invoke(DynamicInterceptor.java:97)
at org.jboss.system.InterceptorServiceMBeanSupport.invokeNext(InterceptorServiceMBeanSupport.java:238)
at org.jboss.ws.integration.jboss.DeployerInterceptor.start(DeployerInterceptor.java:92)
at org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.start(SubDeployerInterceptorSupport.java:188)
at org.jboss.deployment.SubDeployerInterceptor.invoke(SubDeployerInterceptor.java:95)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
at $Proxy26.start(Unknown Source)
at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
at sun.reflect.GeneratedMethodAccessor54.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
at $Proxy8.deploy(Unknown Source)
at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:421)
at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:634)
at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263)
at org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(AbstractDeploymentScanner.java:336)
at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
at $Proxy0.start(Unknown Source)
at org.jboss.system.ServiceController.start(ServiceController.java:417)
at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
at $Proxy4.start(Unknown Source)
at org.jboss.deployment.SARDeployer.start(SARDeployer.java:302)
at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:766)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
at $Proxy5.deploy(Unknown Source)
at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:482)
at org.jboss.system.server.ServerImpl.start(ServerImpl.java:362)
at org.jboss.Main.boot(Main.java:200)
at org.jboss.Main$1.run(Main.java:490)
at java.lang.Thread.run(Unknown Source)
09:16:46,862 INFO [EJBDeployer] Deployed: file:/C:/java/jboss-4.0.5.GA/server/default/deploy/MedicalEJB.jar
09:16:46,987 INFO [TomcatDeployer] deploy, ctxPath=/MedicalWeb, warUrl=.../tmp/deploy/tmp63256MedicalWeb-exp.war/
09:16:47,315 INFO [TomcatDeployer] deploy, ctxPath=/jmx-console, warUrl=.../deploy/jmx-console.war/
09:16:47,503 ERROR [URLDeploymentScanner] Incomplete Deployment listing:
--- MBeans waiting for other MBeans ---
ObjectName: jboss.j2ee:service=EjbModule,module=MedicalEJB.jar
State: FAILED
Reason: java.lang.StringIndexOutOfBoundsException: String index out of range: 0
--- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---
ObjectName: jboss.j2ee:service=EjbModule,module=MedicalEJB.jar
State: FAILED
Reason: java.lang.StringIndexOutOfBoundsException: String index out of range: 01Simple Doctor table:
CREATE TABLE [dbo].[Doctors](
[DoctorId] [int] IDENTITY(1,1) NOT NULL,
[firstName] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[lastName] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
CONSTRAINT [PK_Doctors] PRIMARY KEY CLUSTERED
[DoctorId] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]Most of DoctorBean.java was createded automatically with xdoclet, I created these items manually but with no success:
* @jboss.entity-command
* name="mssql-get-generated-keys"
* @jboss.unknown-pk
* class="java.lang.Integer"
* column-name="doctorid"
* field-name="doctorid"
* jdbc-type="INTEGER"
* sql-type="int"
* auto-increment="true"DoctorBean.java:
package com.bdintegrations.MedicalApp.EJB;
import java.rmi.RemoteException;
import javax.ejb.EJBException;
import javax.ejb.EntityContext;
import javax.ejb.RemoveException;
* <!-- begin-xdoclet-definition -->
* @ejb.bean name="Doctor"
* jndi-name="Doctor"
* type="CMP"
* primkey-field="doctorid"
* schema="DoctorSCHEMA"
* cmp-version="2.x"
* @ejb.persistence
* table-name="dbo.Doctors"
* @ejb.finder
* query="SELECT OBJECT(a) FROM DoctorSCHEMA as a"
* signature="java.util.Collection findAll()"
* @ejb.pk
* class="java.lang.Object"
* generate="false"
* @jboss.entity-command
* name="mssql-get-generated-keys"
* @jboss.unknown-pk
* class="java.lang.Integer"
* column-name="doctorid"
* field-name="doctorid"
* jdbc-type="INTEGER"
* sql-type="int"
* auto-increment="true"
* @jboss.persistence
* datasource="java:/MSSQLDS"
* datasource-mapping="MS SQLSERVER2005"
* table-name="dbo.Doctors"
* create-table="false" remove-table="false"
* alter-table="false"
* <!-- end-xdoclet-definition -->
* @generated
public abstract class DoctorBean implements javax.ejb.EntityBean {
* <!-- begin-user-doc -->
* The ejbCreate method.
* <!-- end-user-doc -->
* <!-- begin-xdoclet-definition -->
* @ejb.create-method
* <!-- end-xdoclet-definition -->
* @generated
public java.lang.Object ejbCreate(String firstName, String lastName) throws javax.ejb.CreateException {
setFirstname(firstName);
setLastname(lastName);
return null;
// end-user-code
* <!-- begin-user-doc -->
* The container invokes this method immediately after it calls ejbCreate.
* <!-- end-user-doc -->
* @generated
public void ejbPostCreate() throws javax.ejb.CreateException {
// begin-user-code
// end-user-code
* <!-- begin-user-doc -->
* CMP Field doctorid
* Returns the doctorid
* @return the doctorid
* <!-- end-user-doc -->
* <!-- begin-xdoclet-definition -->
* @ejb.persistent-field
* @ejb.persistence
* column-name="DoctorId"
* jdbc-type="INTEGER"
* sql-type="int identity"
* read-only="false"
* @ejb.pk-field
* @ejb.interface-method
* <!-- end-xdoclet-definition -->
* @generated
public abstract java.lang.Integer getDoctorid();
* <!-- begin-user-doc -->
* Sets the doctorid
* @param java.lang.Integer the new doctorid value
* <!-- end-user-doc -->
* <!-- begin-xdoclet-definition -->
* @ejb.interface-method
* <!-- end-xdoclet-definition -->
* @generated
public abstract void setDoctorid(java.lang.Integer doctorid);
* <!-- begin-user-doc -->
* CMP Field firstname
* Returns the firstname
* @return the firstname
* <!-- end-user-doc -->
* <!-- begin-xdoclet-definition -->
* @ejb.persistent-field
* @ejb.persistence
* column-name="firstName"
* jdbc-type="VARCHAR"
* sql-type="varchar"
* read-only="false"
* @ejb.interface-method
* <!-- end-xdoclet-definition -->
* @generated
public abstract java.lang.String getFirstname();
* <!-- begin-user-doc -->
* Sets the firstname
* @param java.lang.String the new firstname value
* <!-- end-user-doc -->
* <!-- begin-xdoclet-definition -->
* @ejb.interface-method
* <!-- end-xdoclet-definition -->
* @generated
public abstract void setFirstname(java.lang.String firstname);
* <!-- begin-user-doc -->
* CMP Field lastname
* Returns the lastname
* @return the lastname
* <!-- end-user-doc -->
* <!-- begin-xdoclet-definition -->
* @ejb.persistent-field
* @ejb.persistence
* column-name="lastName"
* jdbc-type="VARCHAR"
* sql-type="varchar"
* read-only="false"
* @ejb.interface-method
* <!-- end-xdoclet-definition -->
* @generated
public abstract java.lang.String getLastname();
* <!-- begin-user-doc -->
* Sets the lastname
* @param java.lang.String the new lastname value
* <!-- end-user-doc -->
* <!-- begin-xdoclet-definition -->
* @ejb.interface-method
* <!-- end-xdoclet-definition -->
* @generated
public abstract void setLastname(java.lang.String lastname);
/* (non-Javadoc)
* @see javax.ejb.EntityBean#ejbActivate()
public void ejbActivate() throws EJBException, RemoteException {
// TODO Auto-generated method stub
/* (non-Javadoc)
* @see javax.ejb.EntityBean#ejbLoad()
public void ejbLoad() throws EJBException, RemoteException {
// TODO Auto-generated method stub
/* (non-Javadoc)
* @see javax.ejb.EntityBean#ejbPassivate()
public void ejbPassivate() throws EJBException, RemoteException {
// TODO Auto-generated method stub
/* (non-Javadoc)
* @see javax.ejb.EntityBean#ejbRemove()
public void ejbRemove() throws RemoveException, EJBException,
RemoteException {
// TODO Auto-generated method stub
/* (non-Javadoc)
* @see javax.ejb.EntityBean#ejbStore()
public void ejbStore() throws EJBException, RemoteException {
// TODO Auto-generated method stub
/* (non-Javadoc)
* @see javax.ejb.EntityBean#setEntityContext(javax.ejb.EntityContext)
public void setEntityContext(EntityContext arg0) throws EJBException,
RemoteException {
// TODO Auto-generated method stub
/* (non-Javadoc)
* @see javax.ejb.EntityBean#unsetEntityContext()
public void unsetEntityContext() throws EJBException, RemoteException {
// TODO Auto-generated method stub
public DoctorBean() {
// TODO Auto-generated constructor stub
}JSP client page snippet:
<%
DoctorHome home = DoctorUtil.getHome();
Doctor doctor = home.create("Jon","Smith");
%>
<%=doctor.getDoctorid() %>thanksNevermind.. no one bothered to inform the developer that the path to the collection AND the path to the directory that the collection is for are different on this other server.
Fixed. -
Impossible to use service without causes error in auto increment ContentID
Description of the bogue : impossible to use a service from a filter or idscriptextension without causing an error in a database, which causes an error auto increment ContentID
UCM : Version:10.1.3.5.1 (100623) (Build:7.2.4.74)
Database : Oracle XE or ORACLE 11g (same bogue)
OS : windows XP
Specific Configuration : Automatically assign a content ID on check in : is checked
We create an UCM componnent with : One Query : Q1, one Service S1, the service call the Query. The query is simple retrieve query. We create a filter « ValidateStandard » and we call service S1. In this filter, We do not change the Content ID.
Call service works great via url ... idc / idcplg? IdcService = S1 ..
The Check Is Ok, document has been published but in « Console output from the Content Server » we have this error :
the log :
+(internal) 07.15 10:49:36.395 IdcServerThread-26 !csJdbcCommitCalledInAutoCommitMode,IdcServerThread-26 (!csJdbcCommitCalledInAutoCommitMode,IdcServerThread-26)-exception stack+
intradoc.data.DataException: !csJdbcCommitCalledInAutoCommitMode,IdcServerThread-26
at intradoc.jdbc.JdbcWorkspace.commitTran(JdbcWorkspace.java:1113)
at intradoc.data.WorkspaceTransactionWrapper.commitTransaction(WorkspaceTransactionWrapper.java:61)
at intradoc.server.ServiceRequestImplementor.commitTransaction(ServiceRequestImplementor.java:358)
at intradoc.server.ServiceRequestImplementor.doActions(ServiceRequestImplementor.java:1211)
at intradoc.server.Service.doActions(Service.java:447)
at intradoc.server.ServiceRequestImplementor.executeActions(ServiceRequestImplementor.java:1121)
at intradoc.server.Service.executeActions(Service.java:433)
at intradoc.server.ServiceRequestImplementor.doRequest(ServiceRequestImplementor.java:635)
at intradoc.server.Service.doRequest(Service.java:1707)
at intradoc.server.ServiceManager.processCommand(ServiceManager.java:359)
at intradoc.server.IdcServerThread.run(IdcServerThread.java:197)
+(internal) 07.15 10:49:38.788 TaskMonitor c:/oracle/ucm/server/custom/ContentAccess-win32/win32/lib/contentaccess//htmlexport.exe -c c:/oracle/ucm/server/vault/~temp/htmlexport/550541262.hda -f c:/oracle/ucm/server/vault/~temp/550541261/550541261.htm+
+(internal) 07.15 10:49:38.888 TaskMonitor Unexpected abort by process 'HtmlExport'.+
requestaudit 07.15 10:50:00.499 Audit Request Monitor Request Audit Report over the last 120 Seconds****
requestaudit 07.15 10:50:00.499 Audit Request Monitor -Num Requests 12 Errors 0 Reqs/sec. 0,1 Avg. Latency (s
In the counter table the RevClassId column is not incremented but the RevId is incremented
If we re publish a document, we have a failure
Content Server Request Failed Content item 'SGTI-000146' was not successfully checked in. The content ID 'SGTI-000146' is not unique.
We encounter the same problem when the service is called from an extended Idoc function. Idoc function is called in a rule from a derivedField
We are inspired by the book example of B. "Bex" Huff
and we use as recomanded
serviceBinder.clearResultSets();
serviceBinder.getLocalData().clear();
any ideas ?You need to install the same major version of the runtime as the executable was built in. Installing older/newer versions of the runtime won't make any difference (although that doesn't hold true for device drivers like VISA, DAQmx) and won't allow you to run your executable.
LabVIEW executables REQUIRE the runtime - it is not possible to run a LabVIEW executable without it.
You need:
- Your application
- The LabVIEW runtime installed that matches the version the application was built in
- Any appropriate additional device drivers (e.g. NI VISA) or NI components
You are missing *something* from your installation...if you are using the MODBUS library I'm almost certain you will need NI VISA (as it uses serial or TCP/IP).
If your PC isn't booting, like I said - try to boot it without a network connection and see if that works.
Edit: Have you tried searching the forums for that specific error? I very quickly found this: https://forums.ni.com/t5/LabVIEW/HTTP-Client-Error-OpenHandle-vi-returns-error-code-1967362015/td-p/.... You might need to include some additional components in your installer like the web application server or the system web server.
Certified LabVIEW Architect, Certified TestStand Developer
NI Days (and A&DF): 2010, 2011, 2013, 2014
NI Week: 2012, 2014
Knowledgeable in all things Giant Tetris and WebSockets -
Auto increment with collection is not working
I am using KODO 3.0 with MYSQL 4.0.16. I have created two JDO object as
follows
BankAccount contains a collection of Contacts object. My metadata looks
like this
<class name="BankAccount">
<field name="contacts">
<collection element-type="Contacts"/>
<extension vendor-name="kodo" key="element-dependent"
value="true"/>
</field>
</class>
<class name="Contacts" objectid-class="Contacts$contactId">
<field name="contactId" primary-key="true">
<extension vendor-name="kodo" key="jdbc-auto-increment"
value="true"/>
</field>
</class>
There is no problem in the persisting of BankAccount object and adding
Contacts to it, but Contacts collation is not retrieved along with parent
object. In the database join table, the contact Id value it is always set
to null.
Things are working well with out contact id in Contacts.
Can anyone help?
Regards,
dharmiSet the following property:
kodo.jdbc.AutoIncrementConstraints: true
Described here:
http://www.solarmetric.com/Software/Documentation/latest/docs/ref_guide_pc_oid.html#ref_guide_pc_oid_pkgen_autoinc -
Retrieve new row's auto-increment key from dataprovider
** cross posted on SDN JSC Forum and Netbeans J2EE Nabble forum **
I have a page that is bound to a MySQL table rowset or, alternately, a new (append()'ed) row. The row's Primary Key is a MySQL auto-increment Integer (translates to a Long.) After commit()'ing the the new row to the database, how would I then get the new row's ID (fieldname "ID")? If I refresh() the dataprovider and try to get the value an error is thrown.
Some background: The dataprovider's backing rowset has a query parameter for the ID field. I set it to "0" if the page is creating a new row or I set it to the unique ID if the page is displaying an existing row. After the new row is committed, I need the new ID set the query parameter and synch up related rows in different tables that are keyed off the ID in this (master) table. I'd like to do this without "guessing" what the ID would be in advance as that method isn't foolproof in heavy usage.
Additionally, it strikes me as a useful workaround if the unique ID was a UUID (mySQL UUID() function) that does not run the risk of any concurrency issues. Has anyone used this solution in VWP? How would I make the call for the underying DB (in this case MySQL, but could be anything) to generate the UUID? Is the call DB specific or is there a JDBC equivalent?
UPDATE: never mind the GUID question, I can use the java.rmi.dgc.VMID class to autogenerate unique GUID's for this purpose. Being from a Lotus Notes background, I'm used to the power and flexibility such Unique ID's bring to the app. dev's portfolio.
Thanks in adv. for any help .
-Jake
Message was edited by:
jakeochsJSF together with JBoss Seam offers some real good possibilities to improve developer productivity. Right now, with JSF you can create forms where fields are persistent (saved in a database), but you have to write code to persist fields. In Notes/Domino, every field you drop in the form is automatically set to persist without writing a single piece of code. JBoss Seam aims to provide the missing glue to tie the JSF beans with business logic (EJB) and persistent layer (JPA). I think tools for Seam are still not mature. I would love to see JSC/VWB utilizing Seam. I know there is a NetBean plugin for Seam but it was written for old NetBeans (not VWP or JSC), so it doesn't work with the visual web pack where you can drag and drop JSF components.
-
Auto Increment of primary key value in jdeveloper.
hi all,
i have one table with one primary key.
i want to increment that primary key when ever i go for CreateInsert or create operation in JSF page.
i have tried with db sequence value type, but i was not able to achieve my condition. in DB Sequence i got error like cannot convert java.class.string to java.class.dbsequence.
can any one suggest me in this to achieve my condition.
regards,
M vijayalakshmi.hi all,
from this i found the simple method to achive the auto increment of primary key.
http://www.techartifact.com/blogs/2012/10/adding-number-for-primary-key-in-oracle-adf-using-groovy-by-sequence.html#ixzz2EeU9CWo6
in this am facing an one small issue.
intial value of the primary key is 1.
for this value i have entered the row of data.
again i have clicked on the create button.
then the value of the primary key has increased to 2.
for this value i didnt entered the row of data to databse.
just i closed the browser.
if i run the run page again, the value of primary key is 3.
my requirment is i shd get the value of primary key is "2".
the increment shd happen the maxi value present in the primary key of the table.
can any one help me in this how to achive this.
thanks in advance.
regards,
M vijayalakshmi. -
Hello every one,
i have to write the code that used for diffrent databases like oracle,sql-server2000..
the problem has generated at the auto increment field...
the problem is as follows....
1) Identity field in sql-server but not in oracle because for oracle it uses index
i try like
<id name="id" column="id">
<generator class="increment"/>
</id>
it works fine for oracle but not for sql-server and ....
<id name="id" column="id">
<generator class="identity"/>
</id>
it works fine for sql-server but not for oracle because the id field is not null and it gives error that null field is not allowed ....
is there any other solution....then please help me
thanks
pandev84hello frnd,
thanx for reply..
but how can i map these files in config file...
pls help..
thanx and regards,
Pandev84If you can't be bothered to spell out these words, and historically you also can't be bothered to answer questions or read documentation (hint: the answer to your question can be found here http://hibernate.org) why should people help you? -
Auto Increment column in database table
Hello experts, I am using oracle 11g database at windows 7.I have to create a sequence object and a table with an auto increment ID column.For this I have created a trigger before insert to select next sequence from a sequence object. It works well but Now I have the current sequence is 7 and there are 6 records inserted in table. Now I delete two records.Thus I have only 5 records in table but my current sequence is still 7.So if I put it in id column then a new record will be inserted in table with 7 ID number after 5th ID number.I want this record should be inserted with 6 Id number. For this I tried to not use sequence object.I tried a pl/sql trigger before insert, which will count the all records in table and after increment i put it in ID column to insertion....Is this a professional way..? thank You regards aaditya
979801 wrote:
Hello experts, I am using oracle 11g database at windows 7.I have to create a sequence object and a table with an auto increment ID column.For this I have created a trigger before insert to select next sequence from a sequence object. It works well but Now I have the current sequence is 7 and there are 6 records inserted in table. Now I delete two records.Thus I have only 5 records in table but my current sequence is still 7.So if I put it in id column then a new record will be inserted in table with 7 ID number after 5th ID number.I want this record should be inserted with 6 Id number. For this I tried to not use sequence object.I tried a pl/sql trigger before insert, which will count the all records in table and after increment i put it in ID column to insertion....Is this a professional way..? thank You regards aaditya
Sequences only guarantee unique numbers. You cannot (and should not) attempt to create gapless sesquences. That's not how oracle works and will not scale to a multi user application.
Imagine two people try to insert records at the same time (and have yet to commit), the trigger you create will count the number of records and determine there are 5 records, so assign the next number of 6, for both people who are inserting records. The first person to commit will get their data saved, and assuming you have a unique constriaint on that id, the second person will raise a duplicate key on insert or suchlike error.
Gapless sequential numbers are not appropriate to multi-user environments. Such requirements are often given by managers or business people who do not understand the technology.
Think of it in terms of a real world office, but with people using a paper system instead of a computer. The only way you can try to guarantee people get the next number and also re-use numbers that have been deleted is to have a single place where each person in the office goes to, to fetch the next number, and they have to queue up behind each other to get the next one off the list. But if someone has removed an old record, they've got to wait in the same queue to go and put that number back in the pot for someone else to use. It just doesn't work, even in a manual system. Yes, people can guarantee that they're only getting unique numbers that nobody else is using, but they cannot guarantee that they are reusing and filling gaps etc. It's an unrealistic expectation. -
Prefixing and auto-increment field
Hello
I have a web application (php/mySQL) that has an auto-increment primary key field called job_id.
Could anyone help me add a prefix to this?
I want to add the year and month (YYMM/) in front of the field (e.g. 0811/1234 then 0811/1235 assuming current month and year is Nov 2008).
Maybe Im wrong about adding the prefix to the primary key. Should I maybe add an additional field to maintain this?
Any advice greatly appreciated...
Regards
PaulHi Paul,
MySQL table and column names may only consist of letters, underscores and numbers anyway, so the date format you´d like to use would lead to errors due to the forward slashes.
Maybe Im wrong about adding the prefix to the primary key.
I don´t know what you want to achieve with this approach, but I´d really leave the name of the Primary Key column "as is" and use a different column for storing data which contains such date values.
Cheers,
Günter Schenk
Adobe Community Expert, Dreamweaver -
Trigger Bad Bind Value Auto Increment
I am new to the Oracle world and am trying to make the switch from MySQL so my apologies if this seems like a silly question.
I am trying to figure out what is wrong with my trigger code. Basically , I am trying to create an auto-increment solution using some example code I found on the Internet.
I have a fairly simple table structure:
CREATE TABLE "CIMS"."computerSoftware"
( "computerSoftware_id" NUMBER(11,0),
"cid" NUMBER(11,0) DEFAULT 0 NOT NULL ENABLE,
"publisher" VARCHAR2(100 CHAR) DEFAULT NULL,
"name" VARCHAR2(100 CHAR) DEFAULT NULL,
"version" VARCHAR2(100 CHAR) DEFAULT NULL,
"serialNumber" VARCHAR2(100 CHAR) DEFAULT NULL,
"unlimited" NUMBER(4,0) DEFAULT 0,
"copies" NUMBER(9,0) DEFAULT 1 NOT NULL ENABLE,
"master" NUMBER(4,0) DEFAULT 0,
PRIMARY KEY ("computerSoftware_id")
My Trigger looks like this:
CREATE OR REPLACE TRIGGER "CIMS"."TR_CompSoftware_ID"
BEFORE INSERT ON CIMS."computerSoftware"
REFERENCING OLD AS OLD NEW AS NEW
FOR EACH ROW
BEGIN
IF (:new.computerSoftware_id IS NULL) then
SELECT S_CompSoftware_ID.NEXTVAL
INTO :new.computerSoftware_id
FROM dual;
end IF;
END;
And finally, here is my sequence:
CREATE SEQUENCE "CIMS"."S_CompSoftware_ID" MINVALUE 1
MAXVALUE 999999999999999999999999999 INCREMENT BY 1 START WITH 1 CACHE 10 NOORDER NOCYCLE
When I try to save the trigger I receive the following error:
PLS-00049: bad bind variable 'NEW.COMPUTERSOFTWARE_ID'
Any help is much appreciated!
TomAnd, this is the way - you can rectify this problem ->
satyaki>
satyaki>drop table "computerSoftware";
Table dropped.
Elapsed: 00:00:00.92
satyaki>
satyaki>CREATE TABLE computerSoftware
2 (
3 computerSoftware_id NUMBER(11,0),
4 cid NUMBER(11,0) DEFAULT 0 NOT NULL ENABLE,
5 publisher VARCHAR2(100 CHAR) DEFAULT NULL,
6 name VARCHAR2(100 CHAR) DEFAULT NULL,
7 version VARCHAR2(100 CHAR) DEFAULT NULL,
8 serialNumber VARCHAR2(100 CHAR) DEFAULT NULL,
9 un_limited NUMBER(4,0) DEFAULT 0, -- Need to change the name of your column due to use of reserve word
10 copies NUMBER(9,0) DEFAULT 1 NOT NULL ENABLE,
11 master NUMBER(4,0) DEFAULT 0,
12 constraints pk_cid PRIMARY KEY (computerSoftware_id)
13 );
Table created.
Elapsed: 00:00:00.20
satyaki>
satyaki>
satyaki>CREATE SEQUENCE S_CompSoftware_ID MINVALUE 1
2 MAXVALUE 999999999999999999999999999 INCREMENT BY 1 START WITH 1 CACHE 10 NOORDER NOCYCLE;
Sequence created.
Elapsed: 00:00:00.05
satyaki>
satyaki>
satyaki>CREATE OR REPLACE TRIGGER TR_CompSoftware_ID
2 BEFORE INSERT ON computerSoftware
3 REFERENCING OLD AS OLD NEW AS NEW
4 FOR EACH ROW
5 BEGIN
6 IF (:new.computerSoftware_id IS NULL) then
7 SELECT S_CompSoftware_ID.NEXTVAL
8 INTO :new.computerSoftware_id
9 FROM dual;
10 end IF;
11 END;
12 /
Trigger created.
Elapsed: 00:00:00.98
satyaki>
satyaki>insert into computerSoftware(cid,publisher,name,version,serialNumber,un_limited,copies,master)
2 values(1,'ABP','SR','1.0.0.1','1.4.3',88,7,9);
1 row created.
Elapsed: 00:00:00.14
satyaki>
satyaki>commit;
Commit complete.
Elapsed: 00:00:00.05
satyaki>
satyaki>
satyaki>select * from computerSoftware;
COMPUTERSOFTWARE_ID CID PUBLISHER NAME VERSION
1 1 ABP SR 1.0.0.1
Elapsed: 00:00:00.05
satyaki>Got me?
Regards.
Satyaki De. -
Hi all,
In the JSP ,if I include the statement <%@ page import="jack.samples.*" %>
it is throwing following error:
This is the Error Message from the Exception:
Server caught unhandled exception from servlet [BaseServlet]: Server caught
unhandled exception from servlet [CategoryDisplay]: Server caught unhandled
exception from servlet [jsp]: Fatal Error: missing resource: java.util.PropertyResourceBundle
I am using Websphere 3.5 on Windows NT.
can somebody please help me what is going wrong here ???I am stopped at
this problem for last 2 days.
Thanks
JackHi,
Finally I was able to resolve after adding this jar file to the classfile
path of the application.
Now,I am trying to access use linkTable.add(new Item(222,"222","333",12.33)) in JSP.
where linkTable is a LinkedList.
It fails giving following error:
This is the Error Message from the Exception:
Server caught unhandled exception from servlet [BaseServlet]: Server caught unhandled exception from servlet : Server caught unhandled exception from servlet [jsp]: Compilation of "softproduct.jsp" failed: d:\ibm\WAServer\temp\default_host\WCSServlets\_jameco_2F_softproduct_2E_jsp_jsp_2.java:824: No constructor matching Item(int, java.lang.String, java.lang.String, double) found in class jack.samples.Item. linkTab.add(new Item(2222,"222","222",22.33)); ^ Note: d:\ibm\WAServer\temp\default_host\WCSServlets\_jameco_2F_softproduct_2E_jsp_jsp_2.java uses or overrides a deprecated API. Recompile with "-deprecation" for details. 1 error, 1 warning
I dont understand why it is failing to add Item object to LinkedList.
can somebody help me in the forum in this regard.
Thanks
Jack
Maybe you are looking for
-
Multiple form parameters with the same name not passed to remote portlet
I have an html select box that contains several values, and multiple selection is enabled. When my code runs as a remote portlet, the following is showing up in the soap monitor when I select multiple values and submit the form: <urn:interactionParam
-
Drawing Tools Acting As If Shift Key Being Held Down
Hey guys, Small problem here with Adobe Acrobat Reader 8.0.0. When drawing square, oval, etc., the shapes are coming up as if the Shift Key was being held down. This also happens when trying to draw a box to place a digital signature. Check my keyboa
-
My camera has disapeared and I do not know how to reinstall it
pls help me my camera icon has disapeared, so what to do to get the camera back and working???
-
Help--How can I open only one java program at one time?
How can I open only one java program(same program) in Windows at one time?
-
Pointing my new domain name too my .mac homepage
Hi, please can someone tell me how to point my new domain name to my .mac account? I usually have to change DNS settings but I can't find them anywhere on this site. Thanks