I create a scheduler that in the same transaction delete rows in DB and insert new rows after delete.
But if the adding of rows fails, I lost my data because the delete was correctly.
How I can delete and add with the same transaction to avoid losing data in case of errors?
I want to do a delete and two different adds in the same table.
How can i do a Transactional method in Liferay 7.3?
1.1k Views Asked by Simone Sorgon At
1
There are 1 best solutions below
Related Questions in JAVA
- Add image to JCheckBoxMenuItem
- How to access invisible Unordered List element with Selenium WebDriver using Java
- Inheritance in Java, apparent type vs actual type
- Java catch the ball Game
- Access objects variable & method by name
- GridBagLayout is displaying JTextField and JTextArea as short, vertical lines
- Perform a task each interval
- Compound classes stored in an array are not accessible in selenium java
- How to avoid concurrent access to a resource?
- Why does processing goes slower on implementing try catch block in java?
- Redirect inside java interceptor
- Push toolbar content below statusbar
- Animation in Java on top of JPanel
- JPA - How to query with a LIKE operator in combination with an AttributeConverter
- Java Assign a Value to an array cell
Related Questions in DATABASE
- When dealing with databases, does adding a different table when we can use a simple hash a good thing?
- How to not load all database records in my TListbox in Firemonkey Delphi XE8
- microsoft odbc driver manager data source name not found and no default driver specified
- Cloud Connection with Java Window application
- Automatic background scan if user edit column?
- Jmeter JDBC Connection Configuration Parametrization of Database URL for accessing SQL Database
- How to grant privileges to current user
- MySQL: Insert a new row at a specific primary key, or alternately, bump all subsequent rows down?
- Inserting and returning autoidentity in SQLite3
- Architecture: Multiple Mongo databases+connections vs multiple collections with Express
- SQL - Adding a flag based on results within a query - best practice?
- Android database query not returning any results
- Developing a search and tag heavy website
- Oracle stored procedure wrapping compile error with inline comments
- Problems communicating with mysql in php
Related Questions in TRANSACTIONS
- C# MySQL Transaction commit
- Multiple transaction managers - Selecting a one at runtime - Spring
- Django transactions: managing two different transactions atomically inside the overriding of save() method
- How can I add FOR UPDATE to a cakephp3 query?
- Why my mysql transaction is not working properly?
- Multiple Hibernate transactions in a JTA session
- Using transaction in Ruby On Rails controller method
- Google Analytics duplicate transaction id multiple domains
- How to limit dynamic queries to only accept select statements?
- combining rollback in two action rails 4
- Symfony2: transactions fail with "There is no active transaction."
- Can RPUSH and LPUSH in Redis race?
- PHP rollback on IBMi db2 doesn't work
- Error in OleDbTransaction
- Wildfly - Infinispan Transactions configuration
Related Questions in LIFERAY
- how to bypass the necessity of having to have email address firstname and lastname in liferay to import authenticating users
- How to resolve java.lang.StringIndexOutOfBoundsException: String index out of range: -325 while deploying Liferay Ext plugin 6.1
- Avoid log trace of external framework J2EE
- Unit testing with Liferay 6.2
- Customize Liferay search portlet
- Build Liferay web service with optional parameter
- How to start with liferay
- Embedding Microsoft Power BI into Liferay
- Remove " Automatically Extracted Metadata and Version History " from Liferay portlet
- Get list of users in liferay
- How to pass HTTP request to Web-Service
- How to land users to different page as per their roles
- Incorrect liferay-plugins dependency
- How to pass data from page to Portlet class through AJAX call?
- EL Exception on JSP when passing arguments to liferay-ui:message
Related Questions in LIFERAY-7.3
- Unresolved requirement: Import-Package: com.liferay.portal.kernel.portlet.bridges.mvc; version="[2.0.0,3.0.0)"
- Liferay - how to retrieve body content of POST request in "serveResource" method
- Liferay js bundler - unused node modules not removed
- Liferay portal 7.3.7 case insensitive, diacritics free with ElasticSearch
- Circular dependency In Liferay Studio
- How can i do a Transactional method in Liferay 7.3?
- Email services is not working on my liferay 7.3 ga5
- Deploying required bundles for Vaadin OSGI portlet to Liferay 7.3
- Add ACCOUNT SETTINGS " page on Custom Site "page" on Liferay7.3.6
- Error java.lang.IllegalStateException: Unable to obtain OutputStream because Writer is already in use
- Service Access Quotas Liferay 7.3
- Error while Extending classic Theme Liferay 7.3
- Liferay portal jquery not working after sometimes
- CSS: Is there a way to not lose hover, if the mouse goes off for a split-second?
- Liferay 7: Is it possible to get an image for from a linked site to a sitemap automatically?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
There are three cases:
If your code were everything starts is in a method a LocalServiceImpl class generated by service builder:
If your code is in a MVCActionCommand, you can use the BaseTransactionalMVCActionCommand as the parent class and implement your code in the doTransactionalCommand method.
If your code is outside of the LocalServiceImpl classes, you can always manually create a transaction using TransactionInvokerUtil: