robert trudel

0

votes
0

answer
3

views

Duplicate data in the child object

I use spring boot 2.1 with spring data jpa and hibernate @Entity public class Factories{ @Id @SequenceGenerator(name = 'factories_id_seq', sequenceName = 'factories_id_seq', allocationSize = 1) @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = 'factories_id_seq') private Integer id; @O...
robert trudel
1

votes
1

answer
685

views

Projects, Files, Services, Navigator color background

In netbeans when we choose a profile in fonts & colors option screen that change editor windows background color but not one in project, files, service navigator. like you can see in the picture i'm the only one with this issue? Edit seem like impossible NetBeans, theme with black background
robert trudel
0

votes
0

answer
4

views

Display unicode character

I use spring boot 2 with thymeleaf 3. I try to display an unicode character I get this error There was an unexpected error (type=Internal Server Error, status=500). Exception evaluating SpringEL expression: 'specialTry ? ☑ : ''' I tried th:utext='${sample.specialTry} ? '☑' : ''' only # is displa...
robert trudel
1

votes
1

answer
343

views

Build with parameters with java 8

I use spring, java 8 and gradle. In Java 8, you can use reflection to access names of parameters of methods. This makes the @Param annotation unnecessary, since Spring can deduce the name of the JPQL parameter from the name of the method parameter. http://docs.oracle.com/javase/tutorial/reflect/memb...
robert trudel
1

votes
2

answer
1.4k

views

JPA update with a join

I use spring-jpa with hibernate implementation. I use mariadb I try to do an update with a join. My object structure @Entity public class Room { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long roomId; @ManyToOne @JoinColumn(name = 'appartment_id') private Appartment appartment; }...
robert trudel
1

votes
1

answer
29

views

Feed a list with the last value

I have theses entity and I do this query. select r from RentAmount r Join r.lodger l join l.bailList b where r.unpaidBalance > 0 and (r.paymentDueDate > :date or r.paymentDueDate is null ) and b.paymentPeriod= order by r.rentAmountId') Is there a way to feed Lodger.bailList only with the last bail...
robert trudel
1

votes
1

answer
27

views

Loop via a each but function unknown

I get json value and i loop on rentFeatureOption. This part work. { 'bailId': 2, 'fromDate': '2016-03-11', 'toDate': null, 'lodgerId': 1, 'supportTwoPerson': false, 'lodgerPayforTwo': false, 'roomId': 1, 'appartmentId': 1, 'price': 500.0, 'paymentPeriod': 'WEEK', 'address': '460 Ch. Chambly, Lon...
robert trudel
1

votes
1

answer
224

views

Reflection and thymeleaf

I use spring boot and thymeleaf. I have many entity and I need to create crud ui. All ui will be similar Is it possible to use reflection to reduce ui to generate? I would like to loop on the fields and get value in the thymeleaf template
robert trudel
1

votes
2

answer
361

views

Strategy pattern in a spring controller

In a spring boot application, In one of my controller, I used a strategy pattern to feed some data. @Component public class SearchStrategy extends AbstractStrategy implements Strategy { //spring ui model private final Model model; public SearchStrategy(Model model) { super(model); this.model = model...
robert trudel
1

votes
1

answer
514

views

Use returned server parameter to display data

I tried to use jQuery DataTables. Before I used bootstrap table. On the server, I use spring boot, spring data with paging. memberId name phone1 phone2 email $('#example').DataTable({ 'processing': 'true', 'serverSide': 'true', 'ajax': { 'url': '/rest/members', 'data': function (d) { return { search...
robert trudel
1

votes
1

answer
2.2k

views

Compare int and string in thymeleaf

I use thymeleaf 3 with spring boot 2 have a integer and a string to do a compare i tried ${car.id}==${generic.value}' but it's always false
robert trudel
0

votes
0

answer
3

views

UnsupportedOperationException with use fetch instead of join

I use spring boot 2 with spring data jpa and hibernate implementation I do a custom search public Page advancedSearch(SamplesSearchDto search, Pageable page) { Specification specification = genericAdvancedSearch(search); return this.findAll(specification, page); } My genericAdvancedSearch method Spe...
robert trudel
1

votes
1

answer
429

views

Application don't start anymore after using aop

I use spring boot2, spring 5 For my controller, I have theses package com.murphys.lcm.controller.mvc com.murphys.lcm.controller.rest I would like to call getAllAdvice method for all my method in theses two packages @Aspect @Component public class LogActionAspect { private final Logger logger = Log...
robert trudel
0

votes
0

answer
16

views

Display page get many Uncaught ReferenceError

I use spring boot 2 and thymeleaf 3. On one of my page, when user click on a link
robert trudel
0

votes
0

answer
20

views

Request parsing error when array of value is sent

I use spring boot 2 User can select multiple value. I try to get theses value on the server side My html Sélectionner un type de test 2019 2018 ... When user click button, I do var form = transForm.serialize('#exportYearsForm'); form = JSON.stringify(form); $.ajax({ type:'get', url: '/exports', dat...
robert trudel
1

votes
1

answer
33

views

Array don't take all the space

I use twitter bootstrap 3 I have an table http://jsfiddle.net/swm53ran/301/ column don't use all the space available. Is there a possiblity to use all the space
robert trudel
1

votes
3

answer
27

views

loop on element json array

In local storage i have this syntax Key #setupHospitalCity:hospitalCity Value {'data': [ {'cityId':1,'city':'Abercorn'}, {'cityId':2,'city':'ActonVale'}, {'cityId':3,'city':'Adstock'}, {'cityId':4,'city':'Aguanish'}, {'cityId':5,'city':'Akulivik'} ], 'ttl':1443541460054} With this code, var values...
robert trudel
0

votes
1

answer
38

views

Get return function value in promise

I use javascrip and promise. I search a way to get return value where xxxx is wrote, is there a way to get it jQuery.ajax({ success: function(data, status, jqXHR){ const promise = requestUpdated(data.poviderId); promise.then(function(data_tt) { return updateAircrafts(data.sspId, data.id); //result...
robert trudel
1

votes
2

answer
231

views

Don't have access to data attribute

I have some row in a table, I would like to have only a form for all the web page instead having one for every one. Every row can be edited or delete. I tried to use data attribute to share use it to do a generic action. html ..Are you sure? js $('[id^=deleteButton]').button({ icons: { primary: 'ui-...
robert trudel
5

votes
2

answer
5.8k

views

HQL, left join on the same table

I search a way to do a left join with the same table with hql. It's my query FROM Tvshow e LEFT JOIN Tvshow e1 ON e1.num = e.num WHERE e1.code = '024' AND e.code is not null AND e.code != '024' Hibernate don't seem to like on operator.
robert trudel
2

votes
3

answer
5.4k

views

keep only number, letter and remove space

I try to keep only letter and number String str = 'it's too hard & jean say'; String strNew = str.replaceAll('[^A-Za-z0-9\\s]', ''); I tried with this code but space is not removed. so i search a way to remove it.
robert trudel
21

votes
6

answer
7.7k

views

How to reset between tests

I have a test class @RunWith(SpringRunner.class) @DataJpaTest I have two tests. In every test I do the same operation, persist the object. Only the find call are different. If I run both tests together they fail but if I run test one after another they are successful. There is no reset between each...
robert trudel
2

votes
2

answer
132

views

difference between two regex

I have two regex: «(\w+\.)+?» and «(\w+\.)+» I think the first one will try to find the minimum of pattern, but for the next one, I don't know. Does somebody have any idea?
robert trudel
5

votes
1

answer
3.9k

views

@DataJpaTest needing a class outside the test

In a SpringBoot application, I would like to do some test about the repository layer. @RunWith(SpringRunner.class) @DataJpaTest public class VisitRepositoryTest { @Autowired private TestEntityManager entityManager; @Autowired private VisitRepository visitRepository; ... } When I try to run test from...
robert trudel
1

votes
2

answer
95

views

Not able to feed a template

I use handlebars and i use a helper to use condition in template; I do an ajax call to a rest architecture, i receive this data { 'firstName':'Paul', 'lastName':'Smith', 'operationType': 'Achat', 'transactionDate':'17/08/2015', 'operationValue':3, 'reason':'Achat nourriture Tim Horton', 'transacti...
robert trudel
1

votes
1

answer
2.4k

views

Convert a string date from json to Java LocalDate

I use spring boot and spring 4. @EntityScan(basePackageClasses = {ServerApplication.class, Jsr310JpaConverters.class}) @SpringBootApplication @EnableCaching public class ServerApplication { public static void main(String[] args) { SpringApplication.run(ServerApplication.class, args); } } I try to us...
robert trudel
1

votes
1

answer
494

views

Spring boot Ambiguous handler

I use Spring Boot. I created theses two method: @RequestMapping(value = '/user/{userId}', method = RequestMethod.GET) public UserAppDto getNameByUserId(@PathVariable('userId') Long userId) { return userService.getByUserId(userId); } @RequestMapping(value = '/user/{username}', method = RequestMethod....
robert trudel
2

votes
2

answer
129

views

Stop process if there is an error in the constructor

In a utility class file, I want to open a file to read or write it. If I can't open it, I don't want to continue the process. FileUtility::FileUtility(const char *fileName) { ifstream in_stream; in_stream.open(filename); } FileUtility fu = FileUtility('bob.txt'); fu.read(); fu.write(); File bob.txt...
robert trudel
2

votes
2

answer
100

views

Java stream none match multiple condition

In a dto to bean conversion, I try to add dto only if dto is not found in the bean... or if the id of the dto is null I use stream with none match. When i try to add many car, only the first one is added List cars = bean.getCar(); List carsDto = dto.getCar(); for (CarDto carDto : carsDto) { if (cars...
robert trudel
2

votes
2

answer
28

views

ConcurrentModificationException with iterator

In a DTO I have public class ProductTypesDto extends BaseDto { private List colors = new ArrayList(); ... } In my beans @Entity public class ProductTypes @ManyToMany private Set colors = new HashSet(); ... } An user can add and remove colors for a productTypes In a DTO to bean conversion, I do priv...
robert trudel
3

votes
2

answer
3.5k

views

log base 2 and nan

I use the code below to calculate log base 2. Math.log(x)/Math.log(2); With this function, i get nan if x=4/5. With calc, excel this problem don't exist. How to avoid to get nan and get the real value?
robert trudel
1

votes
3

answer
23.3k

views

Multiplying two matrices in R

I have 2 matrices. The first one: [1,2,3] and the second one: [3,1,2 2,1,3 3,2,1] I'm looking for a way to multiply them. The result is supposed to be: [11, 13, 10] In R, mat1%*%mat2 don't work.
robert trudel
3

votes
0

answer
235

views

Not able to save hstore in postgresql

I use spring boot, spring data jpa with hibernate (5.2.10) implementation. Postgresql 9.6 In my entity object I have @Column(columnDefinition = 'hstore') @Convert(converter = MapToStringConveter.class) private Map fields = new HashMap(); @Converter public class MapToStringConveter implements Attribu...
robert trudel
1

votes
2

answer
373

views

How to return a value depending on whether an Optional value is present or not?

I use Optional in a controller @GetMapping(value = '/address/{id}') public ResponseEntity getAddressById(@PathVariable('id') Integer id) { Optional address = addressService.getAddressById(id); return new ResponseEntity(address.get(), address.isPresent() ? HttpStatus.OK : HttpStatus.NOT_FOUND); } Act...
robert trudel
1

votes
4

answer
125

views

Assign an array in a constructor

in a class i have a public attribute TissueCompartments: class Diver { public: TissueCompartments tissueCompartments[16]; Diver(); Diver(const Diver& orig, TissueCompartments tissueCompartments[16]); virtual ~Diver(); }; and i have a constructor Diver::Diver(const Diver& orig, TissueCompartments...
robert trudel
1

votes
3

answer
1.1k

views

Regex to validate week and year

I want to validate a string with this pattern: ww/yyyy. With: ^([0-9]{4}), I check if the year has 4 digits. I tried to put these two regex together without success. (5[0-3]|[1-4][0-9]|0[1-9])/^([0-9]{4})
robert trudel
1

votes
2

answer
2k

views

Must use mockbean instead of autowired

I use spring boot 2 I created a basic test @RunWith(SpringJUnit4ClassRunner.class) public class VehicleServiceImplTest { private VehiculeServiceImpl service; @Autowired private VehicleRepository repository; @Before public void prepare() { service = new VehiculeServiceImpl(repository); } @Test public...
robert trudel
2

votes
3

answer
773

views

Limit the number of record from a join

I have this entity @Entity public class RentAmount { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long rentAmountId; private BigDecimal unpaidBalance; private BigDecimal cashAdvance; private BigDecimal totalRentAmount; private LocalDate paymentRentDueDate; private LocalDate paymentDue...
robert trudel
2

votes
1

answer
36

views

Reduce type parameter

In a abstract class, I have public abstract class BaseService { ... } Instead of passing three param, i would like to pass two, to do something like public abstract class BaseService { ... } I get this error > expected '{' expecte wrong number of type arguments; required 1
robert trudel
2

votes
1

answer
519

views

Cache default method of spring data repository

I am using spring data and cache. Is there any way to put cache on default methods of repository (findOne...) without to redeclare those methods in the interface, that we create? public interface AccountOperationRepository extends JpaRepository{ @Cacheable(value = 'myCache') AccountOperation findOn...
robert trudel

View additional