This would be more easy and clear when the firstpost of a Thread is a Post, so I simply can query on the Post-Table ordered by CreationDate and grouped by ThreadId. SaveChanges ; Here is the problem that I get a violation of the foreignkey on Thread. Join table contains foreign keys to parent tables job and prozedur and few extra columns. If i try it in workbench the code does work. That way the foreign key will apply knowing that some fields can be nullable.
Thanks for your answer first. These are all tied to the parent user table by a foreign key, uid, with all of the parent and child keys being int 10. You have any clue what will be possible reasons in this case? So I don't think a 1:1 association is appropriate here anyway. . All of the child tables have a uid value with a foreign key constraint pointing to user. Here you have a varchar 50 referring a varchar 10 , which isn't allowed.
This means that you can't ever insert more than one Post per Thread! And what's the content of the orders table? You'll end up with a very simple model of threads posts? Issue: I am prevented from inserting data into a column because of a foreign key violation. You are trying to apply foreign key on a table which has content and the column is not nullable. And the server warns that. While adding entries to the database getting the error Cannot add or update a child row: a foreign key constraint fails. I would like to do what you suggest! But I would make my life much easier, and the application faster, by using a single-column, auto-generated primary key instead of a composite primary key.
Brian Tkatch wrote:1 Please put the error message in the post. Update works because I assign those values manually, but that is not the right way. But when I have the same models in a non. Have a question about this project? One example for this scene: table1. But i'm getting that error. This was caused by incorrect alter table commands. Yes, that could be an issue, you should probably save a Thread first.
BookingDetail has relation with Booking, Invoice has relation with Booking and BookingDetail. This is what i did. Please consider using placeholders instead. WillCascadeOnDelete false ; } But nothing is working, I get the same exception than before. There is possibility that there is a null value coming from your front end code function and trying to insert into your data table but you have set Not Null constraint. I am not sure may be its because of the built in function multi-treaded of tungsten.
Removing these extra relations cleared up the issue immediately. It works fine when getting data from database into entities but fails when trying to insert new value into join table. Which values are you trying to insert? I'm not going to give my «homework» because I want to learn what I'm doing but I will use an example. Your code gave me an error that a correct mapping between tasks can't be found - But I understand the reason of the issue now. Any ideas would be greatly appreciated.
Thanks to anyone that read this, thank you very much. My observation is that the query from seqno details is going in sequence and if i do execute the query myself it will work. Please correct me on that. Sign up for a free GitHub account to open an issue and contact its maintainers and the community. Concurrency appears to be required as well. Please consider using placeholders instead.
The regression test uses stored functions that insert into an auto-inc column so that in effect there can be inserts into at least 2 auto-inc columns per query. I need to find a solution to accomplish this and stackexchange is my last hope. I finally dropped the table and reconstructed it. I've been working on this for few days now and I see no solution. Then you can add table 2.
It took me a while to realize it was in the subject. Sign up for a free GitHub account to open an issue and contact its maintainers and the community. Moving to MySqlConnector I can't do a simple parent child relationship insertion within a transaction? To solve this you have to truncate table 1 and set the auto increment value back to 1. You could solve this maybe by making Post the principle entity. We stopped at log 'master-bin. Is this any log file option I can see precisely that if it executes in correct order.