Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Java by (10.2k points)

The question is best explained by an example:

In Java for a JPA EntityManager, I can do the following(Account is my Entity class):

Account result = manager.find(Account.class, primaryKey);

In Scala, my naive attempt is:

val result = manager.find(Account.class, primaryKey)

But when I try to use Account.class in Scala, it seems to not like this. How can I specify the java.lang.Class object for the Account class in Scala?

1 Answer

0 votes
by (46k points)
classOf[Account] in Scala is equivalent to Account.class in Java.

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Browse Categories

...