Explore Courses Blog Tutorials Interview Questions
0 votes
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
Welcome to Intellipaat Community. Get your technical queries answered by top developers!

30.5k questions

32.5k answers


108k users

Browse Categories