Skip to content

Instantly share code, notes, and snippets.

@AdamBien
Created January 7, 2021 19:12
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AdamBien/a149e756cbdf591cd817a060a182d755 to your computer and use it in GitHub Desktop.
Save AdamBien/a149e756cbdf591cd817a060a182d755 to your computer and use it in GitHub Desktop.
83rdAirhacksQ&A.md

Ask questions and see you at February, 8th, 8.PM. CET: https://vimeo.com/event/154379

Also checkout recent episode:

82nd airhacks.tv

Please keep the questions Jakarta EE-stic. Means: as short and as concise as only possible. Feel free to ask several, shorter questions. Upcoming airhacks.tv events are also going to be announced at meetup.com/airhacks

@thehpi
Copy link

thehpi commented Jan 22, 2021

Hi,

I have some JPA entities that contain some attributes that I need audit log for.

I know the EntityListener but thats invoked for the whole record. Is there a way to 'see' which attributes are changed (without storing a copy of the record using @PostLoad)

best regards, Hans

@thehpi
Copy link

thehpi commented Jan 27, 2021

Hi,

I'm using payara with eclipselink as JPA implementation. If you query an entity (which has lazy relations) in an EJB and the EJB returns the object then the tx is closed and the object is not attached anymore to the entitymanager.

I read on stackoverflow that when you access the sub objects, eclipselink will automatically run queries on the db to get them.
E.g. hibernate would typically throw an exception (I think hibernate also has support for something similar these days)

However when such objects are serialized and deserialized this auto query mechanism doesn't work anymore.

Three questions:

  1. are you aware of any documentation about this feature
    - I could not find it on the eclipse site
  2. when does payara serialize/deserialize entity objects?
    - I need to know this because in such situations problems will occur if the sub objects are accessed.
  3. are there other things I need to keep in mind when using LAZY relations?

best regards,

Hans

@dempile
Copy link

dempile commented Jan 27, 2021

Hi Adam,

  • In a large project with multiple modules, what is the best practice for naming the database tables, is it by concatenating mudule name+ table name , or just separating by schemas?
  • I want to inject microprofile properties in @ApplicationScoped bean using ConfigSource from a database or external file using the microprofile config spi. If the property is updated in database will it be changed in the application without restarting server ?

Thanks

@aldolushkja
Copy link

Using @Gauge and redeploying causes this exception : Caused by: org.jboss.weld.exceptions.DeploymentException: A metric with metricID{"company.name.package.class.methodName"} already exists
Any idea of why?
The only fix i found was commenting out the @Gauge annotation

@thehpi
Copy link

thehpi commented Feb 1, 2021

I'm using json to send to a jaxrs endpoint which updates data in my db.
I want to be able to send partial requests (so no all attributes of an entity) so I can e.g. update only one attribute.
Currently I'm doing this by checking for null value in the DTO and not setting the related attribute in the JPA entity.
But then I cannot set an JPA entity attribute to null. Also there are a LOT of null checks as I have many entities/jaxrs endpoints.

Is there a smart way to handle this?

@vanuatoo
Copy link

vanuatoo commented Feb 1, 2021

How do you implement database schema changes in CI pipeline

@FlorinAlexandru
Copy link

Hi Adam,

On DockerHub all the Jakarta EE servers have relative big images. For example:

jboss/wildfly:latest 714MB
open-liberty:latest 501MB
payara/server-full:latest 457MB

Is there are slimmer alternatives? One I can think of is Quarkus but I want to remain in the Jakarta EE servers world.
Is there a way to make current servers slimmer?

Note: when I say big images I compare with Spring Boot apps with custom JRE(created with jdeps and jlink) which are, based on my experience, around 250MB-300MB.

Thanks

@thehpi
Copy link

thehpi commented Feb 3, 2021

Hi Adam,

I use jaxrs and jpa to get data in/out of the db. I however have some entities that contain calculated values that should not exposed to the outside world.

I however cannot change the entity classes to e.g. add annotations (@XmlTransient?).

Currently I have a DTO which do not contain the sensitive fields and mappers to go from entity to dto but all this is cumbersome.

Is there a way to do this without the need for a DTO?

gr. Hans

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