Extending org.dbunit.operation.UpdateOperation

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Extending org.dbunit.operation.UpdateOperation

JV1JFMh5

I want to define my custom UpdateOperation that will return for getOperationData(…), a value where the where caluse contains some custom columns. 

 

For example, it will issue a sql like

 

Update my_table

Set c1=v1, c2=v2

Where name=’yyy’ and column2=’jjj’

 

I see that UpdateOperation has a private constructor which prevents us from extending this.  Is there another way to do get the update we need in dbunit?

 

Tejash

 


NOTICE: This e-mail message and any attachments may contain confidential, proprietary, or privileged information.  If you are not the intended recipient, please notify us immediately by return e-mail, delete this message, and destroy all physical and electronic copies. Thank you.




------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
dbunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/dbunit-user
Reply | Threaded
Open this post in threaded view
|

Re: Extending org.dbunit.operation.UpdateOperation

Luiz Eduardo Guida Valmont-2
Tejash,

I'm not very much into the implementation details of UpdateOperation but you can extend it unless it is marked as final. As for the private constructor, you may not call it neither directly nor indirectly. You must explicitly invoke another constructor.

[after taking a peek at the source]

UpdateOperation constructor has package visibility. You can, however, create a org.dbunit.operation package in your application and move your new operation to that package. Although I have not tested this, I'm pretty sure it's not recommended.

If you take a look at the source, you'll see there ain't no other methods to extend on UpdateOperation. Going up a step in its family tree, you'll see a AbstractBatchOperation. Still, you'll have to the same I-don't-think-it's-recommended thing described above.

You can also extend org.dbunit.operation.DatabaseOperation and, Java-wise, I don't see any problem in doing this. Moreover, you'll get a connection and a dataset, so that should be pretty much all you'll need.

Regards,
Luiz

2009/6/12 Tejash Shah <[hidden email]>

I want to define my custom UpdateOperation that will return for getOperationData(…), a value where the where caluse contains some custom columns. 

 

For example, it will issue a sql like

 

Update my_table

Set c1=v1, c2=v2

Where name=’yyy’ and column2=’jjj’

 

I see that UpdateOperation has a private constructor which prevents us from extending this.  Is there another way to do get the update we need in dbunit?

 

Tejash

 


NOTICE: This e-mail message and any attachments may contain confidential, proprietary, or privileged information.  If you are not the intended recipient, please notify us immediately by return e-mail, delete this message, and destroy all physical and electronic copies. Thank you.




------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
dbunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/dbunit-user



------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
dbunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/dbunit-user
Reply | Threaded
Open this post in threaded view
|

Re: Extending org.dbunit.operation.UpdateOperation

krishnan.1000
To add to this:

What you also need is a data set that you can pass to the updateoperation. You can look at FlatXmlDataSet for more pointers on how to do this.

On Fri, Jun 12, 2009 at 11:13 AM, Luiz Eduardo Guida Valmont <[hidden email]> wrote:
Tejash,

I'm not very much into the implementation details of UpdateOperation but you can extend it unless it is marked as final. As for the private constructor, you may not call it neither directly nor indirectly. You must explicitly invoke another constructor.

[after taking a peek at the source]

UpdateOperation constructor has package visibility. You can, however, create a org.dbunit.operation package in your application and move your new operation to that package. Although I have not tested this, I'm pretty sure it's not recommended.

If you take a look at the source, you'll see there ain't no other methods to extend on UpdateOperation. Going up a step in its family tree, you'll see a AbstractBatchOperation. Still, you'll have to the same I-don't-think-it's-recommended thing described above.

You can also extend org.dbunit.operation.DatabaseOperation and, Java-wise, I don't see any problem in doing this. Moreover, you'll get a connection and a dataset, so that should be pretty much all you'll need.

Regards,
Luiz

2009/6/12 Tejash Shah <[hidden email]>

I want to define my custom UpdateOperation that will return for getOperationData(…), a value where the where caluse contains some custom columns. 

 

For example, it will issue a sql like

 

Update my_table

Set c1=v1, c2=v2

Where name=’yyy’ and column2=’jjj’

 

I see that UpdateOperation has a private constructor which prevents us from extending this.  Is there another way to do get the update we need in dbunit?

 

Tejash

 


NOTICE: This e-mail message and any attachments may contain confidential, proprietary, or privileged information.  If you are not the intended recipient, please notify us immediately by return e-mail, delete this message, and destroy all physical and electronic copies. Thank you.




------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
dbunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/dbunit-user



------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
dbunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/dbunit-user



------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
dbunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/dbunit-user