Skip to content

Instantly share code, notes, and snippets.

@AdamBien
Created September 7, 2023 19:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AdamBien/132643f891e116fe0d0e0722f63fb7d5 to your computer and use it in GitHub Desktop.
Save AdamBien/132643f891e116fe0d0e0722f63fb7d5 to your computer and use it in GitHub Desktop.
115thAirhacksQ&A.md
@bytesarray
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 ?
Cheers

@grimly
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.

@grimly
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 ?

@grimly
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).

@vanuatoo
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?

@thiagoslino
Copy link

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

Thank you.

@kriehzoo
Copy link

kriehzoo commented Oct 2, 2023

Hi Adam!
What do you think about using database ids on the REST API? I am trying to keep them out of my domain models as I consider them an implementation detail. Instead I try to use business keys. In case you do the same, how do you handle composite keys on the REST API?

@kriehzoo
Copy link

kriehzoo commented Oct 2, 2023

Another question on identifiers: When I need to generate an identifier and I cannot use a database sequence (e. g. because I am on a client), then one option is using UUID. Now a colleague pointed me to ULID. What do you think about UUID vs. ULID, do you use it in your projects?

@kriehzoo
Copy link

kriehzoo commented Oct 2, 2023

On AWS, when to use DocumentDB vs. DynamoDB vs. AuroraV2? What are your criteria for picking one of them because it seems that many developers are defaulting to relational database systems.

@kriehzoo
Copy link

kriehzoo commented Oct 2, 2023

On AWS, when to use SQS vs. SNS vs. Kinesis? I have a use case where I need to notify a client application about data changes and I have different clients that are not allowed to see each others notifications. Would EventBridge also be an option to send events to client applications?

@bojanb
Copy link

bojanb commented Oct 2, 2023

HI Adam

Is it possible to use S3 bucket as source from CodeBuild which has a VPC access. By default codebuild was working perfectly with S3, then I add codebuild to VPC and connection to S3 stop working. I added NAT gateway and I manage to get access back. Can I avoid NAT somehow - to reduce costs. Maybe use VPC endpoints are the solution?

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