Data manipulation

Report a typo

Imagine we have the following classes:

  • An entity class:

Java
public class HeightAdjustableDesk {
    private Long id;
    private String manufacturer;
    private Integer maxHeight;
}
Kotlin
class HeightAdjustableDesk(
    var id: Long,
    var manufacturer: String,
    var maxHeight: Int
)
  • A repository class:

Java
public class HeightAdjustableDeskRepository extends CrudRepository<HeightAdjustableDesk, Long> {
}
Kotlin
interface HeightAdjustableDeskRepository :
    CrudRepository<HeightAdjustableDesk, Long>
  • Also, we have an initialized repository.

Please sort the instructions in the following order:

  1. Create an entity with id=42, manufacturer=Anatomica, maxHeight=74.

  2. Try to get an entity with id=42.

  3. Update the entity from step 2.

  4. Delete the entity from step 3.

Put the items in the correct order
repository.delete(deskEntity) // deskEntity was defined before this instruction
repository.save(new HeightAdjustableDesk(42, "Anatomica", 74))
repository.findById(42)
repository.save(deskEntity) // deskEntity was defined before this instruction
___

Create a free account to access the full topic