Skip to content

Commit

Permalink
[#481] move spring dep to only hyperjaxb, upgrade spring
Browse files Browse the repository at this point in the history
  • Loading branch information
laurentschoelens committed Apr 10, 2024
1 parent 73d1000 commit fb3f8eb
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 35 deletions.
5 changes: 0 additions & 5 deletions basics/tools/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,5 @@
<artifactId>jakarta.activation</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
20 changes: 8 additions & 12 deletions hyperjaxb/ejb/plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@
<groupId>org.jvnet.jaxb</groupId>
<artifactId>jaxb2-basics-tools</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
</dependency>
<dependency>
<groupId>org.jvnet.jaxb</groupId>
<artifactId>hyperjaxb3-ejb-roundtrip</artifactId>
Expand Down Expand Up @@ -62,22 +70,10 @@
<groupId>org.glassfish.jaxb</groupId>
<artifactId>xsom</artifactId>
</dependency>
<!--dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-annotations</artifactId>
</dependency-->
<!--dependency>
<groupId>javax.persistence</groupId>
<artifactId>persistence-api</artifactId>
</dependency-->
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>javax.persistence-api</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring</artifactId>
</dependency>
</dependencies>
<build>
<defaultGoal>install</defaultGoal>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package org.jvnet.jaxb2_commons.plugin.spring;

import com.sun.tools.xjc.BadCommandLineException;
import com.sun.tools.xjc.Options;
import com.sun.tools.xjc.outline.Outline;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
Expand All @@ -8,10 +11,6 @@
import org.springframework.context.support.AbstractXmlApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;

import com.sun.tools.xjc.BadCommandLineException;
import com.sun.tools.xjc.Options;
import com.sun.tools.xjc.outline.Outline;

public abstract class AbstractSpringConfigurablePlugin extends
AbstractParameterizablePlugin {

Expand Down
6 changes: 3 additions & 3 deletions hyperjaxb/ejb/samples/customerservice-cxf/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>3.0.1.RELEASE</version>
<version>5.3.33</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>3.0.1.RELEASE</version>
<version>5.3.33</version>
</dependency>
<!-- Apache CXF -->
<dependency>
Expand Down Expand Up @@ -100,7 +100,7 @@
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>3.0.1.RELEASE</version>
<version>5.3.33</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.example.customerservice.service;

import org.springframework.orm.jpa.support.JpaDaoSupport;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

Expand All @@ -10,23 +11,24 @@
import com.example.customerservice.service.NoSuchCustomerException;

@Transactional
public class CustomerServiceImpl extends JpaDaoSupport implements
CustomerService {
public class CustomerServiceImpl implements CustomerService {

@PersistenceContext
protected EntityManager theEntityManager;

@Transactional(propagation = Propagation.REQUIRED, readOnly = false)
public void deleteCustomerById(final Integer customerId)
throws NoSuchCustomerException {

final Customer customer = getCustomerById(customerId);
getJpaTemplate().remove(customer);
theEntityManager.remove(customer);
}

@Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
public Customer getCustomerById(final Integer customerId)
throws NoSuchCustomerException {

final Customer customer = getJpaTemplate().find(Customer.class,
customerId);
final Customer customer = theEntityManager.find(Customer.class, customerId);

if (customer == null) {
NoSuchCustomer noSuchCustomer = new NoSuchCustomer();
Expand All @@ -42,7 +44,7 @@ public Customer getCustomerById(final Integer customerId)

@Transactional(propagation = Propagation.REQUIRED, readOnly = false)
public Integer updateCustomer(Customer customer) {
final Customer mergedCustomer = getJpaTemplate().merge(customer);
final Customer mergedCustomer = theEntityManager.merge(customer);
return mergedCustomer.getCustomerId();
}

Expand Down
13 changes: 9 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
<joda-time.version>2.5</joda-time.version>
<junit4.version>4.13.2</junit4.version>
<slf4j.version>1.7.36</slf4j.version>
<spring.version>5.3.33</spring.version>
<stax-ex.version>1.8.3</stax-ex.version>
<plexus-build-api.version>1.2.0</plexus-build-api.version>
<plexus-utils.version>3.5.1</plexus-utils.version>
Expand Down Expand Up @@ -397,13 +398,17 @@
<version>${slf4j.version}</version>
</dependency>

<!-- Spring -->
<!-- Spring in Hibernate -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring</artifactId>
<version>2.0.7</version>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>${spring.version}</version>
</dependency>

<!-- Hibernate -->
<dependency>
<groupId>org.hibernate</groupId>
Expand Down

0 comments on commit fb3f8eb

Please sign in to comment.