Insert via Entity bean and Insert via SQL Insert

I am inserting a record in Table A using Entity beans create
method and then into Table B using SQL Insert Statement.
The Table B has a foreign key relationship with Table A.
Will there be an issue with transaction failing etc..


There is already a session bean method calling this entity
bean and the SQL insert. The session bean method's
transactional attribute has been set as "Required". I found
that in some cases the session bean method gets executed
perfectly but does not insert any data in the table.
  I am not sure if the issue is because of the above
statement. Correct me if I am wrong, if the container
creates and Entity bean object, but the data base insert has
not yet taken place i.e. on calling the create method on the
remote interface the Object is created but ejbCreate is not
yet called, may be because ejbCreate is called at some later
time thread in the then the second insert is executed using
the SQL Insert, then the becaue of the FK constraint on the
database this entire transaction fails and rolls back.
  I want to know weather this is a possiblity, i.e can
containers implement it like this.

Issue:
This is another issue related to the previous one.
  I call a create method on the Remote interface of the
entity bean A. There is a after insert trigger on the Table
A which updates some values of the record create with the
entity bean.
 In some cases I find that the values are not getting
updated by trigger.

Possible Reason:-
This could be because the entity bean cache contains some
values of Object A, which is inserted in the database, but
the container has no way of knowing if the values are
getting updated using the trigger, later in the life cycle
of the entity bean if the container updates the record with
the values in its cache(may be by calling ejbStore method)
then the values updated by the trigger are lost.

I am having this issue and the issue in the previous one
only in the production environment and not in the
development ennvironment, I cannot replicate this issue
other wise because in the production environment the are
multiple objects that are to be cached and pooled.
0
Vikranth
10/1/2003 1:22:18 PM
sybase.easerver.j2ee 2067 articles. 0 followers. Follow

1 Replies
595 Views

Similar Articles

[PageSpeed] 0

> I am inserting a record in Table A using Entity beans
> create method and then into Table B using SQL Insert
> Statement. The Table B has a foreign key relationship with
> Table A. Will there be an issue with transaction failing
> etc..
>
Sounds like you are using BMP.  Correct.

If the create occurss, then the 2nd insert should be fine
>
> There is already a session bean method calling this entity
> bean and the SQL insert. The session bean method's
> transactional attribute has been set as "Required". I
> found that in some cases the session bean method gets
> executed perfectly but does not insert any data in the
> table.

If Tx has completed, then you should be able to see the
update in the db.
>   I am not sure if the issue is because of the above
> statement. Correct me if I am wrong, if the container
> creates and Entity bean object, but the data base insert
> has not yet taken place i.e. on calling the create method
> on the remote interface the Object is created but
> ejbCreate is not yet called, may be because ejbCreate is
> called at some later time thread in the then the second
> insert is executed using the SQL Insert, then the becaue
> of the FK constraint on the database this entire
> transaction fails and rolls back.

If you return from the create() call, you should assume that
the row has been added to the db.
>   I want to know weather this is a possiblity, i.e can
> containers implement it like this.
>
> Issue:
> This is another issue related to the previous one.
>   I call a create method on the Remote interface of the
> entity bean A.

create() is on the home interface
 There is a after insert trigger on the
> Table A which updates some values of the record create
> with the entity bean.
>  In some cases I find that the values are not getting
> updated by trigger.
>
The trigger is a db activity so the trigger should fire
unless the insert did not meet the criteria of the trigger.

> Possible Reason:-
> This could be because the entity bean cache contains some
> values of Object A, which is inserted in the database, but
> the container has no way of knowing if the values are
> getting updated using the trigger, later in the life cycle
> of the entity bean if the container updates the record
> with the values in its cache(may be by calling ejbStore
> method) then the values updated by the trigger are lost.
>
> I am having this issue and the issue in the previous one
> only in the production environment and not in the
> development ennvironment, I cannot replicate this issue
> other wise because in the production environment the are
> multiple objects that are to be cached and pooled.
0
lance
11/3/2003 6:32:04 PM
Reply:

Similar Artilces:

Insert not Inserting?
Hi guys, i've spent days trying to fig this out but it's passed me. i've basically got down to basics and I can't get information inserted into the db. I have a page with an accessdatasource with an insert command of : INSERT INTO [tblName] ([Name]) VALUES (?) I then have a button on the form with : protected void Button1_Click(object sender, EventArgs e) { AccessDataSource1.InsertParameters.Add("name","test"); Response.Write(AccessDataSource1.Insert().ToString()); }  the insert statement brings back 1 but when I goto the db it has the autogen...

Fields inside UpdatePanel not inserting into database via formview insert mode
I just converted a working FormView to a new layout. It's now on a masterpage with a few updatepanels inside the formview. It still uses the automatically generated Insert, Update, and Delete properties of the datasource. When i click the button to insert the data, everything inserts into the database correctly except the fields that are contained within the updatepanels... I get NULLS for all of them. One thing I found interesting is that once I move a field into an update panel the Two-way databinding checkbox does not show up when I go into the Databindings for that field....

PB9 Crashes Inserting OCX via "Insert Control" Tab
Hi, In PB 9.0.1 Build 6533, in a window, do Insert, Control, OLE, and press the "Insert Control" tab, and get: "Sybase PowerBuilder has encountered a problem and needs to close. We are sorry for the inconvenience". There are other posts for this, but the link to the solution is broken. Thank you Victor Reinhart MaintStar Victor Reinhart ---== Posted via the PFCGuide Web Newsreader ==--- http://www.pfcguide.com/_newsgroups/group_list.asp http://brucearmstrong.wordpress.com/2007/07/10/problems-using-activex-controls/ On 24 Aug 2010 15:54:27 -0700, &qu...

how to insert using Insert()
Could anybody give me or direct me to some good articles on how to use Insert() with sqlDataSource.. I did try google but I am trying to look for something to the point which shows how to use parameters.   Check out this article: http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.sqldatasource.insert(VS.80).aspx--------------------------------------------------------Don't forget to click "Mark as Answer" on the post(s) that helped you.NHibernate with ASP.net Problem-Design-Solution sample applicationScott ASP.net blog Check this link belowhttp://msdn2...

How to insert a String value into an INSERT sql statement
Hello, Eventually I plan to move my inline SQL to a stored procedure.But for now, I am using some inline SQL. Basically my problem is that my INSERT statement is not recognizing the value I want to insert. The value I want to insert is stored in a String variable named myHashedPassword. Here is the sql statement: String sqlStmt =  "INSERT INTO userlogin (UserName,PassWord) VALUES 'specialUser',mydHashedPassword)"; Now the value  stored in myHashedPassword is  "A12XC45SEITRGHFBVR" but when I try to execute the sql insert statement, the value of my String variable "A12XC45S...

Variable Insert to SQL server insert satement setting values for the @variable INSIDE sql
ok, I am on Day 2 of being brain dead.I have a database with a table with 2 varchar(25) columns I have a btton click event that gets the value of the userName,  and a text box.I NEED to insert a new row in a sql database, with the 2 variables.Ive used a sqldatasource object, and tried to midify the insert parameters, tried to set it at the button click event, and NOTHING is working. Anyone have a good source for sql 101/ASP.Net/Braindead where I can find this out, or better yet, give me an example.  this is what I got <%@ Page Language="C#" %><!DOCTYPE html ...

Inserting Data via an SQl query with paremeters...
Hi, Im trying to update a Table using data inputted from the Client. I thought my code for this looked quite good but it's obvioulsy wrong because im getting an error message saying; "Must declare the scalar variable "@FirstName".  Heres the code;private void AddDataBT_Click(object sender, EventArgs e) {string InputFirstName = AddFirstNameTB.Text; string InputSurname = AddSurnameTB.Text;string InputEmailAddress = AddEmailAddress.Text; string InputAge = AddAgeTB.Text;string InputMemeber = AddMemberTB.Text;SqlConnection conn = new SqlConnection(@"Data Sourc...

having trouble in inserting ms-sql via perl
Hello, I am using DBD:sybase driver and trying to insert text file into database (ms-sql). I am able to insert the file without any error, but when i retrieve it, i get only half the file, so i verified and it seems that while insertion only, it gets inserted half the file and not the full. I am not sure what is preventing it to insert full file. text file is not that large (only 9000 bytes). here is the codes i am using. #!/usr/local/bin/perl $ENV{SYBASE} = '/usr/local'; use DBI; use lib "/thishost/unix/cen/wftools"; $XML_FILE = "test.xml" ; ...

How do you insert into two tables from one insert? Or even how would you using two inserts?
I currently insert into one table with:                 SqlCommand comm = new SqlCommand("INSERT INTO UsersTable (UserName, Password, Email) VALUES (@person, @pass, @email)", sqlConnection);                comm.Parameters.AddWithValue("@person", usrnmeLbl.Text);                comm.Parameters.AddWithValue("@pass", hiddenpassLbl.Text);     &n...

Inserting to database in Master page inserts empty recored : SqlDataSource1.Insert()
I’m using the following example, which I found, to insert data to my database: <%@Page Language="C#" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <Script runat="server"> private void InsertShipper (object source, EventArgs e) { SqlDataSource1.Insert(); } </Script> <HTML> <BODY> <FORM id="FORM1" runat="server"> <asp:dropdownlist id="DropDownList1" runat="server" datasourceid=&quo...

DetailsView insert mode = false and when inserting data is not inserted from another gridview
Hi I have 1 Gridview and two detailsview. When i select the Gridview the datakeyname is Contact_Id and this loads my detailsview. When I try to insert a new record on my detailsview if the Contact_Id is set to insertvisible  = True then it inserts fine. But when I set insertvisible = False then the data is not being inserted.  my question is How can bind data from another gridview to Detailsview column when its not  visible.This is what I am  using right now: I am assuming it cannot find textbox3 since insertvisible = false, but How can I bind the data when its visible?...

How do i insert the insert of a variable into a table (SQL Query Syntax)
Hello. My English may be a bit buggy, but i'll try to explain my question.I need to insert into a database the value of a textbox. I use a variable to read the contents of the textbox. Only problem is i don't know the proper SQL Syntax to insert that variable into the table. (INSERT INTO tablename (field1,field2) VALUES (???). Thanks. Hi, please take a look at this page: Inserting into a table Grz, Kris.Read my blog. Handy Firefox plugins for web developers.Workaround for non working Mark as answer buttons....

Error when insert single quote in SQL insert statement
Hi All, I needed to insert few row on record into database, but when user enter "single quote" in the textbox, my system will prompt out error message. did anyone know how to fixed this?? thanks Use parameterized query instead. If you do a search on this, you will not only fix your problem, but know why too. Let us know if you need more help.Limno I think the exact same question was asked yesterday or two days ago. Check this thread http://forums.asp.net/p/1401080/3031890.aspx#3031890Beware of bugs in the above code; I have only proved it correct, not tried it. (Donald Knuth...

Submit Form to insert data into SQL and display with a gridview (edit as well) below how do i insert data into sql table?
I have an asp.net page that has a simple form where a user can submit customers information. Below that I have a gridview which displays customer information submited by the user who is logged in. I have the gridview displaying, sorting and updating as I want however I can't figure out how to bind a button click to insert data into the customer table and then have it refresh the gridview when they submit. Here is the basic code; (I am using AJAX for a calendar when a user wants to edit an appointment date) &lt;div class="leftBar"&gt; <div align=center&...

Web resources about - Insert via Entity bean and Insert via SQL Insert - sybase.easerver.j2ee

Insert key - Wikipedia, the free encyclopedia
The Insert key (often abbreviated INS ) is a key commonly found on computer keyboards . It is primarily used to switch between the two text-entering ...

Inserts Wallpapers & Photos on the App Store on iTunes
Get Inserts Wallpapers & Photos on the App Store. See screenshots and ratings, and read customer reviews.

hud-dot-epa south lincoln insert - Flickr - Photo Sharing!
www.sustainablecommunities.gov/pdf/partnership_accomplish...

Lumia 640 XL - How to insert SIM and memory card - YouTube
Learn how to get started with your Lumia 640 XL or Lumia 640 XL Dual SIM. In this video you'll learn how to insert the SIM cards and the memory ...

Google Maps prankster inserts image of Android robot urinating on Apple logo
It seems even Google Maps can fall victim digital vandalism.

Dear [insert name], Qantas takes your complaint very seriously, honest
What's more annoying than being delayed nine hours on a long-haul flight between Sydney and Los Angeles, while stuck in a seat with a broken ...

Skype to insert advertising into calls
Skype to insert advertising into calls

ISIS inserts disturbing images into N.L. vote Twitter chatter
Note: The CBC does not necessarily endorse any of the views posted. By submitting your comments, you acknowledge that CBC has the right to reproduce, ...

Updates for Google Docs & Slides let you insert & quickly edit images on Android/iOS
Google is today rolling out updates to its Google Docs and Slides mobile apps bringing the ability to insert images directly from the app on ...

Gmail for iOS updated with ‘Insert from Drive’ and ‘Save to Drive’
Google has released an update to Gmail for iOS this afternoon that brings “Insert from Drive” and “Save to Drive” functionality to the iPhone ...

Resources last updated: 12/9/2015 7:40:56 PM