In 1882, Weber enrolled in the University of Heidelberg as a law student,[31] transferring to the University of Berlin after a year of military service.[28] After his first few years as a student, during which he spent much time "drinking beer and fencing", Weber would increasingly take his mother's side in family arguments and grew estranged from his father.[24][23][32] Simultaneously with his studies, he worked as a junior lawyer.[28] In 1886, Weber passed the examination for Referendar, comparable to the bar association examination in the British and U.S. legal systems. Throughout the late 1880s, Weber continued his study of law and history,[28] earning his law doctorate in 1889 by writing a dissertation on legal history titled The history of commercial partnerships in the Middle Ages. This work would be used as part of a longer work, On the History of Trading Companies in the Middle Ages, based on South-European Sources, published in the same year.[33]: ix Two years later, working with August Meitzen, Weber completed his habilitation, Roman Agrarian History and Its Significance for Public and Private Law.[34][1] Having thus become a privatdozent, Weber joined the University of Berlin's faculty, lecturing and consulting for the government.[35]