Skip to content

Instantly share code, notes, and snippets.

Created September 7, 2023 19:50
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Copy link

bytesarray commented Sep 9, 2023

Hello Adam, from your real-world projects' experiences, what is the best JPA & JEE compatible way to model Money and Currency (Euro, Dollar, Yen and so on..) :
Moneta vs JavaMoney vs Joda Money vs plain BigDecimal or Long (and a companion field) to keep number of decimals vs ??? ....

-> Too much alternatives for such a (quite) basic thing !!!
Trying them but still puzzled about which one will be strong, stable, battle proven and still convenient for straight vanilla JEE application with JPA

PS: is there a serach function @airhacks to avoid posting a question already adressed by someone previously ?

Copy link

grimly commented Sep 19, 2023

Hello @bytesarray,

Please don't use double for my bank account.
Actually, if you're working on Forex stuff, BigDecimal is enough. You only need to multiply as currency rates are one-way only. EUR to USD is not the inverse of USD to EUR.

Also, if you're printing on the web, the Intl.NumberFormat does a great job at printing currencies.

Copy link

grimly commented Sep 20, 2023

Hello @AdamBien,

I have two questions :

  1. I was wondering how you manage your authentication and authorization. How do you get your end user in your controllers or how do you check its permissions ?
    With Spring Security, the SecurityContext can get you an Authentication which is roughly no better than an Object because you have to know the implementation to get anything out of it. There are some not so well-known conventions but no strict API therefore it is often pure chaos.
    Is it any better with Jakarta or microprofiles ?

  2. Java 21 is now released (yay !) and Virtual Threads are soon (if not already) there with the LTS flag.
    Do you foresee any gain when using virtual threads for APIs using JPA ? As the database connection pool is limited, will virtual threads still help ?

Copy link

grimly commented Sep 23, 2023

Hello again,

Do you know any good zero-configuration formatting tool for java code out there ?

I'm tired of both debates over spaces, tabs, import order... and PRs full of formatting changes for just 3 lines of actual business line of code.

A tool like Prettier from the javascript world would be nice (and even there I have to fight so they do not put any configuration).

Copy link

vanuatoo commented Sep 26, 2023

I watched your session about Fat Lambdas. As I understood you can run entire Quarkus microservice as one lambda. I understand that it's better to use Dynamo in AWS, but if we have to use Postgres, how we can replace connection pooling in Quarkus application with RDS Proxy or something else?

Copy link

Hello Adam.
What do you think about Jakarta Data specification? How can we use it with BCE?

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment