Comments (6)
Oliver Drotbohm commented
It's all about annotating your custom implementation with @Transactional("yourTransactionManager")
(see Spring reference documentation for details. Same applies to @PersistenceContext
from spring-data-jpa.
jokeway commented
Yes, I know that Spring treatment, so I make the report as type 'Improvement'.
The Respository custom implementation bean registed by 'spring-data', and implemented as part of RepositoryInterface, I think 'spring-data' should handle the Transactional and PersistenceContext automatically by the <jpa:repositories /> setting.
Do not know whether this is a popular demand, but I think that allows me not to modify the code or the base class when switch entity manager factory.
from spring-data-jpa.
wims.tijd commented
annotating custom implementation with @PersistenceContext
(unitName="2nd-pu") did not work.
since i have 2 persistenceunits i had to set its dependecy in the config file and call emf.getEntityManger
where i lost the @Transactional
config
it think it is not an improvement since the custom methods where querying the wrong database
from spring-data-jpa.
jokeway commented
Has no plan to fix it?
from spring-data-jpa.
Oliver Drotbohm commented
To be honest, no. The main reason I am hesitant to activate this is the fact that this would lead to a gap between what's annotated in the code and what actually is happening. Assume you have a configuration of
<jpa:repositories base-package="…" transaction-manager-ref="myTransactionManager" />
if you now annotate the repository interface as follows:
@Transactional
interface CustomerRepository extends Repository<Customer, Long> { … }
This is highly misleading as - if we follow the suggestion - we would need to trigger a transaction with myTransactionManager
which is not in line what @Transactional
requires (using the default PlatformTransactionManager
if no value
attribute is defined). Consider implementing a custom @MyTransactional
annotation and equip that with @Transactional("myTransactionManager")
to avoid scattering the name al over the repositories.
Beyond that, we have exactly 2 votes for this so far, so I think most users value the alignment with @Transactional
semantics
from spring-data-jpa.
Jens Schauder commented
Batch closing resolved issue without a fix version and a resolution indicating that there is nothing to release (Won't fix, Invalid ...)
from spring-data-jpa.
Related Issues (20)
- Upgrade to Eclipselink 3.0.4
- Upgrade to JSqlParser 4.8 HOT 1
- A signed numeric literal in JPQL, a space will be inserted between the sign and the numeric literal after parsing HOT 2
- JPA Save do not return updated Object when the primary Id is not Auto Generated HOT 4
- Example in docs missing @NonNullApi annotation HOT 1
- Can't Access Mysql With 'entityManagerFactory' Error! HOT 2
- Regression for method-based query where predicate compares primary key of `@ManyToOne` relationship HOT 12
- Upgrade to Hibernate 6.4.3
- Calling Stored procedures is always creating a mismatch in type arguments, procedure never found HOT 5
- Limit selection of nested properties HOT 3
- Punctuation affects parameter mapping HOT 5
- possibility of data loss using CrudRepository in case of nested entities as java Record HOT 3
- Mapping collections to SQL arrays does not work with repositories HOT 3
- Could not convert ‘java.util.ArrayList’ to ‘java.lang.String’ using ‘org.hibernate.type.descriptor.java.StringJavaType’ HOT 7
- Upgrade to Hibernate 6.4.4.
- I want to do a countribution where methods with batch keywords are processed through the persistence context. HOT 3
- Add build profile for Hibernate 7.
- Weird Error about Hibernate Proxy Class Cast Exception HOT 4
- Wrong syntax for query join with @Where and @SQLRestriction annotations on child entitities HOT 3
- BUG: from 3.x data-jpa doesn't use lookupQuery() method check @Query when starting HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spring-data-jpa.