I cannot create a new row through dashboard, see the attached image:
Error alert message says: Unique constraint violated.
It seems, that the autogenerated id is not beeing generated.
Solved! it was my fault. I had a the unique flag set on label column.
Related
I am implementing a Interactive grid to perform DML operations on a table.
it has combined primary key of two columns
One primary key column is display only and refer to master table and another primary key column I want to have a LOV to select value. LOV is dynamic lov having a display and return value picked from another table.
Inserts are fine but session state item value is set for one row and all the operations are performed on that same row irrespective of which row is selected.
you can see a sample here
https://apex.oracle.com/pls/apex/f?p=128616:2:1964277347439::NO:::
master table name: sample
detail table name: sample_child
primary key in sample child : ID and Name
pop lov is implemented in NAME
LOV values are picked from table: Sample_uncle
LOV display : ID || '-' || NAME
LOV return : ID
you can try to update blabla column of sample_child table to see the issue.
I am not sure how I can give you access to look at the implementation.
I have already tried all the options I can think of
This is to do with your primary keys, the detail table does not appear to have proper ones, thats why it always tried to update the first entry, and I think this is also why every row is marked when you load the table.
Primary keys also do the annoying thing of refusing to be empty, as you can see if you insert a new row, the middle column(which is a PK) is filled with 't1001'.
Since you are dealing with simple tables(and not a whole bunch of joined tables) I always consider it best to use ROWID as PK. So set ROWID as PK for the master table, and ROWID for the detail table. And have the detail table have a Master table be your master table, and then click on the first column in the detail table and set the master column for it. And I also personaly always hide the column that is linked.
I would advise you use ROWID whenever possible as its just so much easier to work with, it does mean you might need to set up a validation to prevent someone adding duplicated values for your actual PK, but since the PK is in the underlying table, they cant enter it anyways(but if you have a validation, the error will be much prettier), whilst if the column is a PK, APEX will prevent duplicates by default.
I hope this helps
AutoMigrate is not adding constraint UNIQUE for an existing column and that column doesn't have any duplicates.
Note. nothing shown using Debug mode.
any idea?
Problem statement
Assume you have report with an attribute call status
but each status change needs to be recorded and by which user.
So you will most likely end up with
REPORT
REPORT_ID
REPORT_STATUS
STATUS_ID
REPORT_ID
but how should I get the current status without "caculation" (ie get last modified date)
I come up with this solution
REPORT
REPORT_ID
CURRENT_STATUS_ID
REPORT_STATUS
STATUS_ID
REPORT_ID
Assume there are more attributes you need, I suspect this way of creating a table have some issues with hibernate when it try to CREATE REPORT then try to CREATE STATUS.
I just tried to created the hibernate mapping using annotation for this relationship.
Everyone I tried to save.. I get
STATUS_REPORT_PK parent key not found
It means that when is trying to create report status, the report is not created yet.
How do I do a proper mapping that allows me to commit both at the same time
There seems to be a logical inconsistency here
Lets say we need to generate a report. Now the report_id is stored but we need a status ID.
But to get a new status we need to specify a report. Since the report is not created the status can't be created and vice versa.
I'm assuming there are a limited number of status's so lets store them in a table called STATUS
REPORT
REPORT_ID
CURRENT_STATUS_ID
REPORT_STATUS
STATUS_ID
REPORT_ID
STATUS
STATUS_ID
First create a new report and attach an object of status to it.
Then create an object of REPORT_STATUS
Just in case you've set a cascade type remove it. Hibernate gets confused sometimes.
EDIT
You seem to be confused over the tables
The report table will hold the report id, data about the report as well as its current status
The report_status table will hold all the previous status's of the report as well as the current one represented as a composite primary key of status_id and report_id
The status table will hold ALL the possible status's a report can have.
For eg. If the possible status's are "On Hold","In production", "Released", "editing" , these will be stored in the status table.
The other 2 tables will reference this for the status they are referring to.
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '3262-1' for key 'UNQ_CATALOGINVENTORY_STOCK_ITEM_PRODUCT_ID_STOCK_ID'#
This appears when I am trying to add stock to my store, and obviously deletes what I have entered and doesn't let me add anything, help me fix this please, I'm not the most amazing on the computer, so please bare this in mind.
Thanks
Changing
$product->save();
to
$product->getResource()->save($product);
solved this problem for me
I have faced the same issue and debugging it since two days. finally I got the solution and fixed the issue.
This was occurred due to the inconsistency into database tables.
cataloginventory_stock_item
catalog_product_entity
I have removed the all inconsistency data using below query:
DELETE FROM cataloginventory_stock_item where product_id NOT IN (select entity_id from catalog_product_entity)
You can check how much records before perform the delete.
select count(*) from cataloginventory_stock_item where product_id NOT IN (select entity_id from catalog_product_entity)
May be this can help someone!
This error you can look in magento forum.
http://www.magentocommerce.com/boards/viewthread/300959/
This is error with sql index link. Yuo can use $product->getResource()->save($product); for resolve this problem.
https://stackoverflow.com/a/14152754/1844561
It took me hours on google trying to find the correct info that was easy to follow for an amature like me. Eventually using different sources, I figured out what I needed to delete and where I needed to delete it. The below worked for me, hope it works for you.
Go to your database
Find the table named "cateloginventory_stock_item
Delete the last few records on the list (at the bottom of the table)
Voila! You should now be able to enter new products.
1062 Duplicate entry '3262-1' for key 'UNQ_CATALOGINVENTORY_STOCK_ITEM_PRODUCT_ID_STOCK_ID'#
from this its clear that there is some unique constraint and 3262 value already exist in data base.
I suggest you run reindexing and then check.
Basically some entry 3262 didnt got deleted from your stock table so a new entry is throwing error.
I was facing similar issue and fix which I have applied is as follow :
Error : SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '59457-1' for key 'UNQ_CATALOGINVENTORY_STOCK_ITEM_PRODUCT_ID_STOCK_ID'
Solution : There is a table called eav_entity_store, you will have to modify a record where sku / product ID is mentioned, Increase the Increment ID to + 1
and update that record in database. Once you update the Increment ID then you will be able to add the stock.
For Example: If "eav_entity_store" table has last increment_last_id as = 730354, then
I will have to update that record to 730355 and my problem will get resolved :)
SQL Query: update eav_entity_store set increment_last_id = '730355' where eav_entity_store.entity_store_id =$YourStoreID;
if the error showing for the table 'cataloginventory_stock_item' having 'UNQ_CATALOGINVENTORY_STOCK_ITEM_PRODUCT_ID_STOCK_ID' index,
then please sure that you are passing different product SKU from your script each time.because if you pass the same SKU then it will fetch the id of the product on the basis of that SKU and get the duplicate entry of that particular product id.
Also Never Use
$product->save();
to
$product->getResource()->save($product);
because it will not update your product details completely.
I have table in which a constraint has been set on a field called LoginId.While inserting a new row i am getting an error on this constratint associated with this field(LoginID)stating the below error.
The insert command is below:
Type 1 with sequence
insert into TemplateModule
(LoginID,MTtype, Startdate TypeId, TypeCase, MsgType, MsgLog, FileName,UserName, CrID, RegionaltypeId)
values
(MODS_SEQ.NEXTVAL,3434,2843,2453,2392,435,2390,'pension.txt','rereee',454545,3434);
Failed with error
Type 2 without sequence a hardcoded value::
insert into TemplateModule
(LoginID,MTtype, Startdate TypeId, TypeCase, MsgType, MsgLog, FileName,UserName, CrID, RegionaltypeId)
values
(3453,3434,2843,2453,2392,435,2390,'pension.txt','rereee',454545,3434)
I crosschecked many times for duplicates.But nothing found.What could be the rootcause
ORA-00001: unique constraint error (LGN_INDEX)violated
First, do a describe on LGN_INDEX on that table to make absolutely certain you are looking at the right column. Is LGN_INDEX a constraint+index or just an index? Try re-building your index to make sure it isn't corrupt. Make sure you don't have any other constraints that might be interfering.
Second, perform a SELECT MAX(LOGINID) FROM TEMPLATEMODULE and compare that to the next sequence value to make sure your sequence isn't set lower than the maximum ID you are working with.
Third, check if you have any triggers on that table.
If none of these things work, try re-creating the table using just the schema. Cross-load the data and try again. There might be a configuration setting on that table that is causing the issue. CREATE TABLE MY_TEMP AS SELECT * FROM TEMPLATEMODULE.
I encountered the same problem.
An Insert statement populating an Integer value (not in the table) to the Primary Key column.
The problem was a before trigger tied to a sequence. The next_val for the sequence was already present in the table.
The trigger fires, grabs the sequence number and fails with a Primary Key violation.
I encountered this same issue while importing from an excel file. I thought the file was free of duplicates until I tried removing duplicates in excel.
To find and remove duplicates in excel,
Select the data. Ctrl + a should work.
Click Data -> Remove Duplicates
Select the fields that have the constraints in your database and click OK
Excel should remove any duplicate records based on the fields selected at step 3 above.
You should now be able to import records from the file into your db.