How do ORM's implement type-safe queries?

How do ORM's like Java's Hibernate or PHP's Doctrine actually implement type checking? I'm implementing a small POC ORM/DAO for a read-only in-house DB and I'm beginning to investigate on how to actually get type safety to work.

I have model classes similar to

@Table(name = "baseballStats")
public class BaseballStatistic extends PinotModel {

public static final Find FIND = new Find<BaseballStatistic (BaseballStatistic.class) {} ;

@Column(name = "playerID")
private String _playerID = null;

@Column(name = "playerName")
private String _playerName = null;

@Column(name = "teamID")
private String _teamID = null;

@Column(name = "numberOfGames")
private String _numberOfGames = null;
}

and a query generator mostly working except for the type-checking aspect.

Could somebody point me in the right direction?