You will be able to get the Schema Id from ComponentMeta
which is inherited from ItemMeta. First you need to get the ItemDAO
from the StorageManagerFactory
and then findByPrimaryKey
will give to ComponentMeta. This only works after your super.create
which should persist the component to broker db. Try this out.
Sample snippet :
ItemDAO item = (ItemDAO) StorageManagerFactory.getDAO(pubid,StorageTypeMapping.COMPONENT_META);
ComponentMeta meta = (ComponentMeta) item.findByPrimaryKey(pubid,compid);
int schemaID = meta.getSchemaId() ;
Note: you need to pass the pubid, compid from you itemToCreate tcmURI