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 answers
Related Questions in JAVA
- I need the BIRT.war that is compatible with Java 17 and Tomcat 10
- Creating global Class holder
- No method found for class java.lang.String in Kafka
- Issue edit a jtable with a pictures
- getting error when trying to launch kotlin jar file that use supabase "java.lang.NoClassDefFoundError"
- Does the && (logical AND) operator have a higher precedence than || (logical OR) operator in Java?
- Mixed color rendering in a JTable
- HTTPS configuration in Spring Boot, server returning timeout
- How to use Layout to create textfields which dont increase in size?
- Function for making the code wait in javafx
- How to create beans of the same class for multiple template parameters in Spring
- How could you print a specific String from an array with the values of an array from a double array on the same line, using iteration to print all?
- org.telegram.telegrambots.meta.exceptions.TelegramApiException: Bot token and username can't be empty
- Accessing Secret Variables in Classic Pipelines through Java app in Azure DevOps
- Postgres && statement Error in Mybatis Mapper?
Related Questions in DATABASE
- How to add the dynamic new rows from my registration form in my database?
- How to store a date/time in sqlite (or something similar to a date)
- Problem with add new attribute in table with BOTO3 on python
- When an E-R attribute should be perceived as a relationship attribute or as an entity set attribute?
- SQLAlchemy: efficient relationship loading in 3-way many-to-many relationship
- Cannot connect to Postgres Database when running Quarkus Tests with Gitlab ci
- Local or remote database with react-native?
- I want to edit a specific row in database
- How to enter data in mongodb array at specific position such that if there is only 2 data in array and I want to insert at 5, then rest data is null
- Open Web Library
- database login.py and register.py error showing 404 file not found and doesn't work
- SQL71561: SqlComputedColumn: When column selected
- Liquibase as SaaS To Configure Multiple Database as Dynamic
- Updated max input vars but table still shows error
- Spring does not map set of roles
Related Questions in TRANSACTIONS
- How to design the file operation interface involving status and transactions?
- Internal events cannot be consumed in spring boot. Only when using Kafka Consume
- How do you categorize a pending transaction immediately after making a purchase and have it save?
- Spring JPA + Hibernate + Rest services + long time transactions
- How to Identify Specific Transaction Anomalies in a Given Schedule?
- When does shared and exclusive locks are acquired and released in a MySql transactions?
- How to write a reusable DB transaction wrapper?
- "No data" after sending tx Jupiter Swap Python
- Perform multiple Identity actions in a transaction
- Running a program on different computers with different users that access a central database simultaneously - VB.NET XAMPP/MySQL
- Proper way to implement transactional HOTP?
- Transactional role in Java Spring Boot
- Is there a way of increasing MAX_INTEGER in web3.js
- Single transaction, multiple service calls to Entity Framework updating database
- Saving to Reactive Redis and Postgres in a single transaction
Related Questions in LIFERAY
- Liferay DXP Service builder @BeanReference field is null
- How to customize mention notifications in liferay 7.3.5
- Could not find method compileOnly() for arguments
- "error: cannot find symbol import com.liferay.portal.kernel.uuid.PortalUUID;" in Liferay 7.4
- java:41: error: cannot find symbol import com.liferay.portal.kernel.uuid.PortalUUID; in liefray DXP
- liferay, how to add a new permission to liferay using admin panel portal
- Why jmeter/blazemeter is not recording web actions which are in angular?
- liferay-amd-loader - Missing react dependency error in Liferay react application
- Liferay 7.4 | How to Check File Entry Permissions in a Servlet?
- Liferay 7.4 GA107: Unresolved requirement: Import-Package: com.ironsoftware.ironpdf_ [Sanitized]
- Liferay 7.4 theme development with bootstrap/clay css variables in browser
- Liferay 7 Taglib issue with new module in Dev Studio
- Liferay 7.4 GA27+: DLURLHelperUtil.getPreviewURL returning old legacy URL format for Document and Media images
- Freemarker if statements inside html elements
- Uncaught TypeError: A.LiferayItemSelectorDialog is not a constructor - Liferay Portal 7.4 GA 105
Related Questions in LIFERAY-7.3
- Liferay 7.3 How to Search only Content of JournalArticles?
- Error java.lang.IllegalStateException: Unable to obtain OutputStream because Writer is already in use
- Circular dependency In Liferay Studio
- Liferay portal 7.3.7 case insensitive, diacritics free with ElasticSearch
- How can I get an Liferay Asset Entry's friendly URL to its Display Page?
- How can I get the Display Page's Asset Entry in a Liferay Freemarker
- Liferay 7.3.2: Aria-expanded stuck on true after changing a page
- Liferay 7.3: How can I use custom ADTs in a page template?
- Liferay 7: Is it possible to get an image for from a linked site to a sitemap automatically?
- CSS: Is there a way to not lose hover, if the mouse goes off for a split-second?
- Liferay 7.3.7 error "Denied access to model object as it does not belong to current company"
- errors in rest-api while migrating to Liferay 7.4
- How to style data-table search panel for the whole table?
- Dynamic select list in a Liferay MVCPortlet
- Liferay 7.3 adt
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?
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)
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: