Hello,
I have the following 2 entities :
@Entity public class TestEntity implements LocalEntity { @Id @GeneratedValue private Long key; private Long clientKey; private String text1; private String text2; private String text3; private String text4; private String text5; private Object value; // for now just Double values @Index private long timestamp; @Embedded private State state; ... getter/setters ... } @Embeddable public class State { private Long lastProcessingDate; private int processingCount; @Enumerated(EnumType.ORDINAL) @Index private EntityState entityState; ... getters / setters ... }
when I query by the "state" field in TestEntity it tooks several seconds to retrieve the objects (around 5s) and I
think I do something wrong because it's so slow. (DB has around 30.000 rows)
Example query looks like :
String strSelect = "SELECT e FROM TestEntity WHERE e.state.entityState IN :state"; TypedQuery<TestEntity> query = em.createQuery(strSelect, TestEntity.class); query.setParameter("state", EnumSet.of(State.NEW, State.ACKNOWLEDGED)); List<TestEntity> results = query.getResultList();
I would be very happy if someone could give me a hint why this query tooks so long.
edit: I just tried to remove the second entity completely and integrate its 3 variables directly in the TestEntity...
but it makes no difference.
edit2: persisting values is also very slow (5-6s for 30.000 inserts). Environment is JBoss Wildfly 9.0.2. Classes are enhanced...
regards,
paddy